#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int x = 0;
    for (long long j = 0ll; j <= 60ll; j++) {
      if (a[i] & (1ll << j)) x++;
    }
    a[i] = x;
  }
  long long curr = 0ll, cnt0 = 1ll, cnt1 = 0ll, res = 0ll;
  for (int i = 0; i < n; i++) {
    curr += a[i];
    if (curr & 1ll) {
      res += cnt1;
      cnt1++;
    } else {
      res += cnt0;
      cnt0++;
    }
  }
  for (int i = 0; i < n; i++) {
    long long mx = 0ll, sum = 0ll;
    for (int j = i; j < i + 64 && j < n; j++) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (sum % 2ll == 0ll) {
        if (mx > sum / 2ll) res--;
      }
    }
  }
  cout << res;
  return 0;
}
