#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int sufp[N], freq[N][2];
int mi = 0, ma = 0, par = 0;
void add(int x) {
  if (x >= mi and x <= ma) {
    if (x % 2 == par)
      mi = 0;
    else
      mi = 1;
  } else if (x > ma) {
    mi = x - ma;
  } else {
    mi = mi - x;
  }
  if (x % 2) par = 1 - par;
  ma += x;
}
void reset() { mi = ma = par = 0; }
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v, p;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    v.push_back(__builtin_popcountll(x));
    p.push_back(v.back() % 2);
  }
  for (int i = n - 1; i >= 0; i--) {
    sufp[i] = p[i];
    if (i + 1 < n) sufp[i] ^= sufp[i + 1];
  }
  for (int i = 0; i < n; i++) {
    freq[i][0] += sufp[i] == 0;
    freq[i][1] += sufp[i] == 1;
    if (i) {
      freq[i][0] += freq[i - 1][0];
      freq[i][1] += freq[i - 1][1];
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int pos = i;
    reset();
    while (pos >= 0 and (mi > 1 or ma < 60)) {
      add(v[pos]);
      if (mi == 0) ans++;
      pos--;
    }
    if (pos < 0) continue;
    int base = sufp[pos + 1];
    ans += freq[pos][par ^ base];
  }
  printf("%lld\n", ans);
  return 0;
}
