#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 233;
int cnt[maxn], pre[maxn], a[maxn], b[maxn];
int main() {
  int n;
  cin >> n;
  pre[0] = 0;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    cnt[i] = 0;
    while (x) {
      if (x & 1) cnt[i]++;
      x >>= 1;
    }
    pre[i] = pre[i - 1] + cnt[i];
  }
  a[0] = b[0] = 0;
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1];
    b[i] = b[i - 1];
    if (pre[i] % 2 == 0)
      a[i]++;
    else
      b[i]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int sum = 0, maxi = 0, j = i;
    for (j = i;; j++) {
      sum += cnt[j];
      maxi = max(maxi, cnt[j]);
      if (maxi * 2 <= sum && sum % 2 == 0) ans++;
      if (sum >= 130 || j == n) break;
    }
    if (pre[i - 1] % 2 == 0)
      ans += a[n] - a[j];
    else
      ans += b[n] - b[j];
  }
  cout << ans << endl;
  return 0;
}
