#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, odd[maxn], sum[maxn];
long long a, ans, cnt[2][maxn];
inline long long rd() {
  long long res = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) res = (res << 3) + (res << 1) + ch - 48;
  return res * f;
}
int main() {
  n = rd();
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &a);
    while (a) {
      odd[i] += a & 1;
      a >>= 1;
    }
    sum[i] = sum[i - 1] + odd[i];
  }
  for (register int i = 1; i <= n; ++i) {
    if (odd[i] & 1) {
      cnt[0][i] = cnt[1][i - 1];
      cnt[1][i] = cnt[0][i - 1] + 1;
    } else {
      cnt[0][i] = cnt[0][i - 1] + 1;
      cnt[1][i] = cnt[1][i - 1];
    }
    int maxx = -1, p;
    ans += cnt[0][i];
    for (register int l = 1; l <= 64; ++l) {
      p = i - l + 1;
      if (p < 1) break;
      maxx = max(maxx, odd[p]);
      if ((maxx << 1) > sum[i] - sum[p - 1] && !((sum[i] - sum[p - 1]) & 1))
        --ans;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
