#include <bits/stdc++.h>
using namespace std;
inline void re(int &x) {
  x = 0;
  bool flag = false;
  char c = getchar();
  while (c < '0' || c > '9') {
    flag = c == '-';
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ '0');
    c = getchar();
  }
  if (flag) x = -x;
  return;
}
int n;
int a[300010];
int cnt[2][300010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%I64d", &x);
    while (x) {
      if (x & 1) a[i]++;
      x >>= 1;
    }
  }
  cnt[0][0] = 1;
  int now = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int sum = 0, notans = 0, nowmax = 0;
    for (int j = i; j > 0 && i - j <= 64; j--) {
      sum += a[j];
      nowmax = max(a[j], nowmax);
      if (sum % 2 == 0 && sum - nowmax < nowmax) notans++;
    }
    now += a[i];
    ans += cnt[now & 1][i - 1] - notans;
    cnt[0][i] += cnt[0][i - 1];
    cnt[1][i] += cnt[1][i - 1];
    cnt[now & 1][i]++;
  }
  printf("%I64d\n", ans);
  return 0;
}
