#include <bits/stdc++.h>
using namespace std;
long long a[300005], ans;
int n, num[300005], cnt[2] = {1}, sum[300005];
int change(long long x) {
  int ans = 0;
  while (x) {
    ans += (x % 2);
    x /= 2;
  }
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    num[i] = change(a[i]);
    sum[i] = sum[i - 1] + num[i];
    ans += cnt[sum[i] % 2];
    int maxn = 0;
    for (int j = i, k = i + 1; j >= 1 && j >= i - 64; j--) {
      while (k > j) {
        k--;
        maxn = max(maxn, num[k]);
      }
      if (maxn * 2 > sum[i] - sum[j - 1] && (sum[i] - sum[j - 1]) % 2 == 0)
        ans--;
    }
    cnt[sum[i] % 2]++;
  }
  cout << ans;
}
