#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define SZ(x) ((int)(x).size())
#define PB(x) push_back(x)
#define MEMSET(x,v) memset(x,v,sizeof(x))
#define REP(i,n) for(int i=0;(i)<(n);++(i))
#define x first
#define y second
#define INF (0x3f3f3f3f)

typedef long long LL;
typedef pair<int, int> P2;
typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> OST;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
template<class A, class B> inline bool mina(A &x, B y) {return (x > y)?(x=y,1):0;}
template<class A, class B> inline bool maxa(A &x, B y) {return (x < y)?(x=y,1):0;}

const int MAXN = 3e5+5;

int N;
int in[MAXN];
int psum[MAXN];

int main() {
    scanf("%d", &N);
    REP(i, N) {
        LL x;
        scanf("%lld", &x);
        while (x) {
            in[i] += (x & 1);
            x >>= 1;
        }
    }
    for (int i = 1; i <= N; i++) {
        psum[i] = psum[i - 1] + in[i - 1];
    }
    int num_odd = 0;
    int num_even = 0;
    for (int i = 2; i <= N; i++) {
        if (psum[i] % 2 == 0) num_even++;
        else num_odd++;
    }
    LL ans = 0;
    for (int i = 0; i + 2 <= N; i++) {
        if (psum[i] % 2 == 0) ans += num_even;
        else ans += num_odd;
        if (psum[i + 2] % 2 == 0) num_even--;
        else num_odd--;
    }
    cout << ans << endl;
    return 0;
}
