#include <iostream>
using namespace std;

int main() {
    int s = 0; // счетчик
    int n = 0;
    cin >> n;
    while (n != 0){
        if ((n % 2 == 0) && (n % 7 == 0)){
            s = s + 1; // количество найденных чисел
        }
        cin >> n;  
    }
    cout << s << "\n";
	return 0;
}