#include <bits/stdc++.h>
const double pi = 4.0 * atan(1.0);
const double e = exp(1.0);
const int maxn = 3e5 + 8;
const long long mod = 1e9 + 7;
const unsigned long long base = 1e7 + 7;
using namespace std;
long long a[maxn], b[maxn];
long long s[maxn], ss[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    while (a[i]) {
      if (a[i] & 1) {
        b[i]++;
      }
      a[i] >>= 1;
    }
  }
  long long x = 0;
  for (int i = 1; i <= n; i++) {
    x += b[i];
    s[i] = s[i - 1];
    if (!(x & 1)) {
      s[i]++;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ss[i] = s[n];
    if (b[i] & 1) {
      s[n] = n - i - s[n];
    } else {
      s[n] = s[n] - 1;
    }
  }
  long long ma;
  int k;
  for (int i = 1; i <= n; i++) {
    ma = 0;
    x = 0;
    for (int j = i; j <= n && j <= i + 64; j++) {
      x += b[j];
      ma = max(ma, b[j]);
      if (x >= 2 * ma && !(x & 1)) {
        ans++;
      }
    }
    if (i + 64 < n) {
      k = i + 65;
      if (x & 1) {
        ans += n - k + 1 - ss[k];
      } else {
        ans += ss[k];
      }
    }
  }
  cout << ans << endl;
}
