#include <bits/stdc++.h>
using namespace std;
long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 3e5 + 5;
int a[N];
int sum[N];
int cnt[N][2];
int n;
int f(long long x) {
  int res = 0;
  for (; x; x /= 2) {
    res += x % 2;
  }
  return res;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    long long x = read();
    a[i] = f(x);
    sum[i] = sum[i - 1] + a[i];
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    cnt[i][sum[i] % 2]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int MAX = 0;
    for (int j = i; j <= i + 70 && j <= n; j++) {
      MAX = max(MAX, a[j]);
      if (2 * MAX <= sum[j] - sum[i - 1] && ((sum[j] - sum[i - 1]) % 2 == 0))
        ans++;
    }
    if (i + 70 >= n) continue;
    ans += cnt[n][sum[i - 1] % 2] - cnt[i + 70][sum[i - 1] % 2];
  }
  printf("%lld\n", ans);
  return 0;
}
