#include<iostream>
#define ULL unsigned long long

using namespace std;

ULL n, a[500010], rez_and, rez_xor;

int main()
{
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i)
        scanf("%lld", &a[i]);
    rez_and = rez_xor = a[0];
    for (int i = 1; i < n; ++i)
    {
        rez_and &= a[i];
        rez_xor ^= a[i];
    }
    if (rez_and == 0 || rez_xor == 0) cout << "1";
    else cout << "0";
    return 0;
}