#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
int n;
long long a[maxn];
int c[maxn];
int jiou[maxn];
int odd[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    while (a[i]) {
      if (a[i] & 1) {
        c[i]++;
      }
      a[i] >>= 1;
    }
    jiou[i] = c[i] & 1;
  }
  for (int i = n; i >= 1; i--) {
    if (!jiou[i]) {
      odd[i] = odd[i + 1];
    } else {
      odd[i] = 1 + (n - i) - odd[i + 1];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int r = min(n, i + 100);
    int mx = c[i];
    int seg_sum = c[i];
    for (int j = i + 1; j <= r; j++) {
      mx = max(mx, c[j]);
      seg_sum += c[j];
      if (mx + mx <= seg_sum) {
        if (seg_sum & 1) {
        } else {
          ans++;
        }
      }
    }
    if (r < n) {
      if (seg_sum & 1) {
        ans += odd[r + 1];
      } else {
        ans += n - r - odd[r + 1];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
