#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")
#pragma GCC optimize("unroll-loops")
const int K = 65;
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), pref(n), suffOdd(n), suffEven(n);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
    pref[i] = a[i];
    if (i) pref[i] += pref[i - 1];
  }
  if (a.back() % 2 == 0)
    suffEven[n - 1] = 1;
  else
    suffOdd[n - 1] = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] % 2 == 0) {
      suffOdd[i] = suffOdd[i + 1];
      suffEven[i] = suffEven[i + 1] + 1;
    } else {
      suffOdd[i] = suffEven[i + 1] + 1;
      suffEven[i] = suffOdd[i + 1];
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int mx = a[i], s = 0;
    for (int j = i; j < min(n, i + K); j++) {
      s += a[j];
      mx = max(mx, a[j]);
      ans += s % 2 == 0 && s / 2 >= mx;
    }
    if (i + K < n) {
      if (s % 2 == 0)
        ans += suffEven[i + K];
      else
        ans += suffOdd[i + K];
    }
  }
  cout << ans << '\n';
}
