#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n;
long long answer;
int a[maxn], cnt[2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
  }
  cnt[0] = 1;
  int s = 0;
  for (int i = n; i > 0; --i) {
    int sum = 0, mx = 0, cur = 0;
    for (int j = i; j <= n && j - i < 64; ++j) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (2 * mx > sum && sum % 2 == 0) cur--;
    }
    s += a[i];
    cur += cnt[s % 2];
    answer += cur;
    cnt[s % 2]++;
  }
  cout << answer << "\n";
  return 0;
}
