#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a[300010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int ones = 0;
    while (a[i]) {
      ones += a[i] % 2;
      a[i] /= 2;
    }
    a[i] = ones;
  }
  ll ans = 0, sum = 0;
  int re[2] = {0};
  re[0] = 1;
  for (int i = 0; i < n; i++) {
    int x = max(-1, i - 65), mx = a[i], sum1 = a[i];
    sum += a[i];
    ans = ans + re[sum % 2];
    for (int j = i - 1; j >= x; j--) {
      if (sum1 % 2 == 0) {
        if (sum1 - mx < mx) ans--;
      }
      if (j == -1) break;
      mx = max(mx, (int)a[j]);
      sum1 += a[j];
    }
    re[sum % 2]++;
  }
  cout << ans;
  return 0;
}
