#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 400005;
int n;
int a[N];
int ss[N][2];
void solv() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long x;
    scanf("%lld", &x);
    while (x) {
      if (x % 2 == 1) ++a[i];
      x /= 2;
    }
  }
  int ans = 0;
  int s0 = 0;
  for (int i = n; i >= 1; --i) {
    s0 += a[i];
    ss[i][0] = ss[i + 1][0];
    ss[i][1] = ss[i + 1][1];
    ++ss[i][s0 % 2];
    int s = 0;
    int maxu = 0;
    for (int j = i; j <= min(n, i + 70); ++j) {
      s += a[j];
      maxu = max(maxu, a[j]);
      if (s - maxu >= maxu && s % 2 == 0) ++ans;
    }
    ans += (ss[i + 72][s0 % 2]);
  }
  printf("%d\n", ans);
}
int main() {
  solv();
  return 0;
}
