#include <bits/stdc++.h>
using namespace std;
int n;
long long ans, sum[300030], cnt[300030], tot[3];
int main() {
  scanf("%d", &n);
  tot[0] = 1;
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    while (x) {
      cnt[i] += x % 2;
      x >>= 1;
    }
    sum[i] = sum[i - 1] + cnt[i];
    ans += tot[sum[i] % 2];
    for (int j = i, k = i + 1, maxx = 0; j >= 1 && j >= i - 64; j--) {
      while (k > j) maxx = max(1ll * maxx, cnt[k - 1]), k--;
      if (maxx * 2 > sum[i] - sum[j - 1] && ((sum[i] % 2) == (sum[j - 1] % 2)))
        ans--;
    }
    ++tot[sum[i] % 2];
  }
  printf("%lld", ans);
  return 0;
}
