#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
long long abss(long long a) {
  if (a < 0) {
    a = -a;
  }
  return a;
}
long long n;
long long xx;
long long aa[N + 5] = {0}, su[N + 5];
long long mm[105] = {0};
int main() {
  mm[0] = 1;
  scanf("%lld", &n);
  long long ans = 0;
  su[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &xx);
    while (xx) {
      if (xx & 1) {
        ++aa[i];
      }
      xx >>= 1;
    }
    su[i] = su[i - 1] + aa[i];
  }
  long long l[2] = {1, 0};
  aa[0] = 0;
  for (int i = 1; i <= n; ++i) {
    int bitt = su[i] & 1;
    ans += l[bitt];
    long long mx = aa[i];
    long long rem = 0;
    for (int j = i - 1; j >= 0 && j >= i - 63; --j) {
      if ((su[i] - su[j]) % 2 == 0 && rem < mx) {
        --ans;
      }
      if (mx < aa[j]) {
        rem += mx;
        mx = aa[j];
      } else {
        rem += aa[j];
        ;
      }
    }
    ++l[bitt];
    ;
  }
  printf("%lld", ans);
  ;
  return 0;
}
