#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N];
int cnt[N][2], sum[N];
long long ans;
int check(int l, int r) {
  if (sum[r] != sum[l - 1]) return 0;
  int m = 0, s = 0;
  for (int i = l; i <= r; i++) {
    m = max(m, a[i]);
    s += a[i];
  }
  if (s - m >= m)
    return 1;
  else
    return 0;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    a[i] = __builtin_popcountll(x);
  }
  for (int i = 1; i <= n; i++) sum[i] = (sum[i - 1] + a[i]) % 2;
  cnt[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    cnt[i][sum[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (i - 65 >= 0) ans += cnt[i - 65][sum[i]];
    for (int j = max(i - 63, 1); j < i; j++) ans += check(j, i);
  }
  printf("%lld\n", ans);
  return 0;
}
