#include <bits/stdc++.h>
using namespace std;
int n, a[300005], s[300005], X, Y;
long long ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    for (long long j = 0; j < 60; j++)
      if (x >> j & 1) a[i]++;
    s[i] = s[i - 1] + a[i];
  }
  X++;
  for (int i = 1; i <= n; i++) {
    if (s[i] & 1) {
      ans += Y;
      Y++;
    } else {
      ans += X;
      X++;
    }
  }
  for (int i = 1; i <= n; i++) {
    X = a[i];
    for (int j = i; j <= min(n, i + 60 - 1); j++) {
      X = max(X, a[j]);
      if ((s[j] - s[i - 1]) % 2 == 0 && (s[j] - s[i - 1]) < X + X) ans--;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
