#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
int n, c[N], sum[N];
long long a[N];
long long lowbit(long long x) { return x & (-x); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    while (a[i]) {
      a[i] -= lowbit(a[i]), c[i]++;
    }
  }
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + c[i];
  long long ans = 0;
  for (int r = 1; r <= n; r++) {
    int l = max(r - 64, 1), mx = c[r];
    for (int i = r - 1; i >= l; i--) {
      mx = max(c[i], mx);
      if ((sum[r] - sum[l - 1]) % 2 == 0 && mx <= (sum[r] - sum[l - 1] - mx))
        ans++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
