#include <bits/stdc++.h>
using namespace std;
int n, a[311000], s[311000], ji[2];
long long p, k;
int main() {
  cin >> n;
  for (int x = 1; x <= n; x++) {
    cin >> k;
    for (int y = 0; y <= 60; y++) {
      if (k & (1ll << y)) {
        a[x]++;
      }
    }
    s[x] = s[x - 1] + a[x];
  }
  ji[0] = 1;
  for (int x = 1; x <= n; x++) {
    p += ji[s[x] & 1];
    ji[s[x] & 1]++;
    for (int y = x, k = 0; y > 0 && x - y <= 80; y--) {
      k = max(k, a[y]);
      if (!(s[x] - s[y - 1] & 1) && k * 2 > s[x] - s[y - 1]) {
        p--;
      }
    }
  }
  cout << p << endl;
}
