#include <iostream>
#include <climits>
#include <vector>

long long test_xor(std::vector<long long>& a) {
    int osnova = a[0];
    for(int i = 0; i < a.size(); ++i) {
        osnova = osnova ^ a[i];
    }
    return osnova;
}

int test_niz(std::vector<long long>& a) {
    int count = 0;
    long long osnova = a[0];
    for(long long i = 0; i < a.size()-1; ++i) {
        osnova = osnova & a[i];
        long long y = osnova ^ INT64_MAX;
        long long base = 1;
        for(int j = 0; j < 64; j++) {
            long long calc = y & base;
            base *= 2;;
            if(calc != 0) {
                if(a[i+1] == calc) {
                    a[i+1]--;
                    if(test_xor(a) == 0) {
                        a[i+1] += 2;
                    }
                    count++;
                    break;
                }
            }
        }
    }
    return count;
}

int main() {

    std::ios::sync_with_stdio(false);
	std::cin.tie(0);

    std::string ulaz1;
	std::getline(std::cin, ulaz1);

	std::string ulaz2;
	std::getline(std::cin, ulaz2);

	long long N = std::stoi(ulaz1);

	std::vector<long long> niz;

	for(long long i = 0; i < N; ++i) {
		niz.push_back(std::stoi(ulaz2.substr(0, ulaz2.find(" "))));
		ulaz2 = ulaz2.substr(ulaz2.find(" ")+1);
	}

    int c = test_niz(niz);

    std::cout << c;

    return 0;
}