#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
int n, arr[N];
int cnt[N][2];
int pre[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    while (x) {
      if (x & 1) arr[i]++;
      x >>= 1;
    }
  }
  cnt[0][0] = 1;
  long long out = 0;
  for (int i = 1; i <= min(n, 70); i++) {
    int sum = 0, mx = 0;
    for (int j = i; j >= 1; j--) {
      sum += arr[j];
      mx = max(mx, arr[j]);
      if (sum % 2 == 0 && mx * 2 <= sum) out++;
    }
    pre[i] = pre[i - 1] + arr[i];
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    ++cnt[i][pre[i] & 1];
  }
  for (int i = 71; i <= n; i++) {
    int sum = 0, mx = 0;
    for (int j = i; j > i - 70; j--) {
      sum += arr[j], mx = max(mx, arr[j]);
      if (mx * 2 <= sum && sum % 2 == 0) out++;
    }
    pre[i] = pre[i - 1] + arr[i];
    out += cnt[i - 71][pre[i] & 1];
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    ++cnt[i][pre[i] & 1];
  }
  cout << out;
}
