#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> d(n);
  for (int &i : d) {
    long long a;
    cin >> a;
    i = __builtin_popcountll(a);
  }
  long long ans = 0;
  int suf = 0;
  vector<vector<int> > cnt(n + 1, vector<int>(2));
  cnt[n][0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    int second = 0, m = 0;
    for (int j = i; j < min(n, i + 62); j++) {
      second += d[j];
      m = max(m, d[j]);
      if (second % 2 == 0 && 2 * m > second) ans--;
    }
    suf += d[i];
    ans += cnt[i + 1][suf & 1];
    cnt[i][0] = cnt[i + 1][0];
    cnt[i][1] = cnt[i + 1][1];
    if (suf & 1) {
      cnt[i][1]++;
    } else {
      cnt[i][0]++;
    }
  }
  cout << ans << '\n';
  return 0;
}
