#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
int n;
long long x, cnt[2];
int a[300005], s[300005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &x);
    for (int j = 0; j < 60; ++j)
      if (x >> j & 1) ++a[i];
    s[i] = a[i] + s[i - 1];
  }
  ++cnt[0];
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    res += cnt[s[i] & 1];
    ++cnt[s[i] & 1];
    int tmax = 0;
    for (int j = i; j && j >= i - 61; --j) {
      int sum = s[i] - s[j - 1];
      tmax = max(tmax, a[j]);
      if (sum & 1) continue;
      if (tmax * 2 > sum) --res;
    }
  }
  printf("%I64d\n", res);
  return 0;
}
