#include <bits/stdc++.h>
using namespace std;
const int N = 300000 + 5;
long long a[N], pre[N], odd[N], even[N];
int poop(long long a) {
  int ans = 0;
  while (a) {
    if (a & 1) ans++;
    a >>= 1;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  even[0] = 1;
  for (int i = 1; i <= n; i++) {
    a[i] = poop(a[i]);
    pre[i] = (pre[i - 1] + a[i]) & 1;
    odd[i] = odd[i - 1] + pre[i];
    even[i] = even[i - 1] + 1 - pre[i];
  }
  long long ans = 0;
  long long sum, mx;
  for (int i = 1; i <= n; i++) {
    mx = 0;
    sum = 0;
    for (int j = 0; j < 65; j++) {
      if (i - j == 0) break;
      sum += a[i - j];
      mx = max(mx, a[i - j]);
      if (sum % 2 == 0 && sum >= 2 * mx) ans++;
    }
  }
  for (long long i = 66; i <= n; i++) {
    if (pre[i]) {
      ans += odd[i - 66];
    } else {
      ans += even[i - 66];
    }
  }
  cout << ans << endl;
  return 0;
}
