#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << "\n";
  err(++it, args...);
}
const long long N = 3e5 + 5, M = 65, inf = 1e18;
long long cnt[2], a[N], p[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n;
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
  }
  for (int i = 1; i < n + 1; i++) {
    p[i] = a[i] + p[i - 1];
    cnt[p[i] & 1]++;
  }
  long long ans = 0;
  for (int i = 1; i < n + 1; i++) {
    ans += cnt[p[i - 1] & 1];
    long long mx = 0, sum = 0;
    for (int j = i; j < i + M; j++)
      if (j < n + 1) {
        sum += a[j];
        mx = max(mx, a[j]);
        ans -= mx > sum / 2 and sum % 2 == 0;
      }
    cnt[p[i] & 1]--;
  }
  cout << ans;
}
