#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)3e5 + 5;
int n;
int a[maxn], b[maxn];
int cnt[maxn][2];
int jump[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  cnt[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    while (x) {
      a[i] += x & 1, x >>= 1;
    }
    jump[i] = a[i - 1] > 0 ? i - 1 : jump[i - 1];
    b[i] = (b[i - 1] + a[i]) % 2;
    cnt[i][0] = cnt[i - 1][0];
    cnt[i][1] = cnt[i - 1][1];
    cnt[i][b[i]]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int mx = a[i], sum = a[i], j = i;
    while (sum < 128 && j > 0) {
      int k = jump[j];
      if (sum >= 2 * mx) {
        ans += cnt[j - 1][b[i]] - (k > 0 ? cnt[k - 1][b[i]] : 0);
      }
      if (k > 0) {
        sum += a[k], mx = max(mx, a[k]);
      }
      j = k;
    }
    if (j > 0) {
      ans += cnt[j - 1][b[i]];
    }
  }
  cout << ans << endl;
  return 0;
}
