#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
const int N = 3e5 + 10;
int cnt[N], sum[N], n;
long long a;
int f[N][2];
long long ans;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a);
    while (a) a -= (a & (-a)), cnt[i]++;
  }
  for (int i = n; i >= 1; i--) sum[i] = cnt[i] + sum[i + 1];
  for (int i = 1; i <= n; i++) {
    f[i][0] = f[i - 1][0];
    f[i][1] = f[i - 1][1];
    f[i][sum[i] & 1]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int Max = 0, j, Num = 0;
    for (j = i; j >= 1 && Num <= 125; j--) {
      Num += cnt[j];
      Max = max(Max, cnt[j]);
      if (Num >= (Max << 1) && (Num & 1) == 0) ans++;
    }
    ans += 1ll * f[j][sum[i + 1] & 1];
  }
  printf("%I64d\n", ans);
  return 0;
}
