#include <stdio.h>

using namespace std;

typedef long long ll;

int count_z(int a[], int n){
    int nZ = 0;
    for (int i = 0; i < n; i++){
        if (a[i]%2==0) nZ++;
    }
    return nZ;
}
int count_sz(int a[], int n){
    int nsZ = 0;
    for (int i = 0; i < n; i++){
        if (a[i]/2%2==0) nsZ++;
    }
    return nsZ;
}
bool isAnd(int a[], int n){
    int b = a[0];
    for (int i = 1; i < n; i++){
        b = b & a[i];
    }
    return b;
}
bool isXor(int a[], int n){
    int b = a[0];
    for (int i = 1; i < n; i++){
        b = b ^ a[i];
    }
    return b;
}
int main(){
    int n = 0;
    scanf("%d", &n);
    int a[n] = {0};
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    int nZ = -1;
    // check for completion
    bool bXor, bAnd;

    bXor = isXor(a, n);
    bAnd = isAnd(a, n);

    if (!bXor && !bAnd){

        nZ = count_z(a, n);
        if (n % 2 == 1){
            printf("%d", nZ);
        }else{
            int nsZ = count_sz(a, n);
            if (nsZ%2 == 0)
                printf("%d", nZ + 2);
            else
                printf("%d", nZ);
        }
    }
    else if (bAnd){
        if (n % 2 == 1)
            printf("%d", 0);
        else{
            nZ = count_z(a, n);
            if (nZ != 0){
                print("%d", 1);
            } else{
                a[0] - 1;
                if (isAnd(a,n)) printf("%d", 1);
                    else printf("%d", 2);
            }
        }
    }
    else if (bXor){
        nZ = count_z(a, n);
        if (n % 2 == 1)
            printf("%d", nZ);
        else{
            printf("%d", nZ);
        }
    } else{
        printf("%d", 0);
    }
    return 0;
}