#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
long long a[maxn];
long long odd[maxn];
long long even[maxn];
long long sum[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
    a[i] = __builtin_popcountll(a[i]);
    sum[i] = a[i] + sum[i - 1];
  }
  long long ans = 0;
  even[0] = 1;
  for (int i = 1; i <= n; i++) {
    long long mx = a[i];
    for (int j = i - 1; j >= max(i - 61, 1); j--) {
      mx = max(mx, a[j]);
      long long s = sum[i] - sum[j - 1];
      if (s >= mx * 2 && s & 1 ^ 1) ans++;
    }
    if (i > 62) ans += sum[i] & 1 ? odd[i - 63] : even[i - 63];
    odd[i] += odd[i - 1] + (sum[i] & 1);
    even[i] += even[i - 1] + (sum[i] & 1 ^ 1);
  }
  printf("%lld\n", ans);
  return 0;
}
