#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[300000 + 5];
long long b[300000 + 5];
long long sum[300000 + 5];
long long even[300000 + 5], odd[300000 + 5];
long long find(long long x) {
  long long y = 0;
  while (x) {
    if (x & 1) y++;
    x >>= 1;
  }
  return y;
}
void readin() {
  scanf("%I64d", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    b[i] = find(a[i]);
  }
}
int main() {
  readin();
  for (long long i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + b[i];
  }
  for (long long i = 1; i <= n; i++) {
    odd[i] = odd[i - 1], even[i] = even[i - 1];
    if (sum[i] & 1)
      odd[i]++;
    else
      even[i]++;
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (sum[i - 1] & 1)
      ans += odd[n] - odd[i - 1];
    else
      ans += even[n] - even[i - 1];
  }
  for (long long i = 1; i <= n; i++) {
    long long m = min(n, i + 64);
    long long maxb = b[i], s = 0;
    for (long long j = i; j <= m; j++) {
      maxb = max(maxb, b[j]);
      s += b[j];
      if (2 * maxb > s && (s & 1) == 0) ans--;
    }
  }
  printf("%I64d", ans);
  return 0;
}
