#include <bits/stdc++.h>
using namespace std;
int cnt[2];
int sum[303030];
int v[303030];
int getnum(long long x) {
  int ret = 0;
  while (x) {
    ret += (x & 1);
    x >>= 1;
  }
  return ret;
}
int main() {
  int n, mx, sum1;
  long long ans = 0, x;
  scanf("%d", &n);
  cnt[0] = cnt[1] = 0;
  sum[0] = 0;
  cnt[0]++;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    v[i] = getnum(x);
    sum[i] = sum[i - 1] + v[i];
    ans += cnt[sum[i] & 1];
    cnt[sum[i] & 1]++;
  }
  for (int i = 1; i <= n; i++) {
    mx = 0;
    sum1 = 0;
    for (int j = 0; j <= 70 && i + j <= n; j++) {
      mx = max(mx, v[i + j]);
      sum1 += v[i + j];
      if ((sum1 & 1) == 0 && (mx << 1) > sum1) ans--;
    }
  }
  printf("%lld", ans);
  return 0;
}
