#include <bits/stdc++.h>
using namespace std;
int n, a[300005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%I64d", &x);
    for (int k = 0; k < 64; k++) a[i] += (x & (1LL << k)) != 0;
  }
  long long res = 0;
  int d[2] = {0, 0};
  for (int i = n - 1; i > 0; i--) {
    if (a[i] % 2 == 1) swap(d[0], d[1]);
    d[(a[i] + a[i + 1]) % 2]++;
    int tmp = a[i], amax = a[i];
    for (int j = i + 1; j <= min(n, i + 64); j++) {
      amax = max(amax, a[j]);
      if ((tmp + a[j]) % 2 == 0 && amax > tmp - amax + a[j]) res--;
      tmp += a[j];
    }
    res += d[0];
  }
  printf("%I64d", res);
  return 0;
}
