#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(228);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  int bad = 0;
  for (int i = 0; i < n; i++) {
    long long sum = 0;
    int mx = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (sum > 300) break;
      if (sum - mx < mx && sum % 2 == 0) {
        bad++;
      }
    }
  }
  int pref = 0;
  int z0 = 1, z1 = 0;
  for (int i = 0; i < n; i++) {
    pref ^= (a[i] % 2);
    if (pref)
      z1++;
    else
      z0++;
  }
  cout << z0 * (long long)(z0 - 1) / 2 + z1 * (long long)(z1 - 1) / 2 - bad
       << '\n';
}
