#include <bits/stdc++.h>
using namespace std;
int n;
long long a[1000000];
int b[1000000];
int cnt[2][1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i] = __builtin_popcountll(a[i]);
  }
  long long ans = 0;
  int ss = 0;
  cnt[0][n] = 1;
  for (int i = n - 1; i >= 0; --i) {
    int sum = 0, mx = 0;
    int lst = i;
    int add = 0;
    for (int j = i; j < n && j - i < 65; ++j) {
      sum += b[j];
      mx = max(mx, b[j]);
      if (mx > sum - mx && sum % 2 == 0) --add;
      lst = j;
    }
    ss += b[i];
    add += cnt[ss & 1][i + 1];
    ans += add;
    cnt[0][i] = cnt[0][i + 1];
    cnt[1][i] = cnt[1][i + 1];
    if (ss & 1)
      ++cnt[1][i];
    else
      ++cnt[0][i];
  }
  cout << ans << endl;
  return 0;
}
