#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 777;
int q[N], o[N], n;
long long a[N], Q[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", a + i);
    int p = 0;
    for (; a[i]; a[i] >>= 1)
      if (a[i] & 1) ++p;
    a[i] = p;
    Q[i] = a[i] + Q[i - 1];
  }
  o[0] = 1;
  for (int i = 1; i <= n; ++i) {
    q[i] = q[i - 1];
    o[i] = o[i - 1];
    if (Q[i] & 1)
      q[i]++;
    else
      o[i]++;
  }
  long long ans = 0;
  for (int i = 62; i <= n; ++i) {
    if (Q[i] & 1)
      ans += q[i - 62];
    else
      ans += o[i - 62];
  }
  for (int i = 1; i <= n; ++i) {
    int mx = 0, sum = 0;
    for (int j = i; j <= i + 60 && j <= n; ++j) {
      mx = max((int)a[j], mx);
      sum += a[j];
      if (sum % 2 == 0 && mx <= sum - mx) ++ans;
    }
  }
  printf("%lld\n", ans);
}
