#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 3e5 + 100;
int n, b[MAXN], cnt[2][MAXN];
long long a[MAXN];
int main() {
  int tt = 1;
  while (tt--) {
    long long res = 0;
    int suff = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      b[i] = __builtin_popcountll(a[i]);
    }
    cnt[0][n] = 1;
    for (int i = n - 1; i >= 0; i--) {
      int sum = 0, mx = 0, k = i, ad = 0;
      for (int j = i; j < n and j - i < 65; j++) {
        sum += b[j];
        mx = max(mx, b[j]);
        if (mx > sum - mx and sum % 2 == 0) --ad;
        k = j;
      }
      suff += b[i];
      ad += cnt[suff & 1][i + 1];
      res += ad;
      cnt[0][i] = cnt[0][i + 1];
      cnt[1][i] = cnt[1][i + 1];
      if (suff & 1)
        ++cnt[1][i];
      else
        ++cnt[0][i];
    }
    cout << res << endl;
  }
  return 0;
}
