#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using pii = pair<int32_t, int32_t>;
using vi = vector<int32_t>;
constexpr int MAXN = 3e5 + 5;
constexpr int MAXL = 80;
int n;
int a[MAXN], p[MAXN], odd[MAXN];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    ll x;
    cin >> x;
    a[i] = __builtin_popcountll(x);
    p[i] = p[i - 1] + a[i];
    odd[i] = odd[i - 1] + p[i] % 2;
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    int mx = 0;
    int t = 0;
    for (int j = i; j <= n and j - i < MAXL; ++j) {
      mx = max(mx, a[j]);
      t += a[j];
      assert(t == p[j] - p[i - 1]);
      ans += t % 2 == 0 and mx + mx <= t;
    }
  }
  for (int i = MAXL + 1, j = 1; i <= n; ++i, ++j) {
    if (p[i] % 2) {
      ans += odd[j - 1];
    } else {
      ans += j - odd[j - 1];
    }
  }
  cout << ans << '\n';
  return 0;
}
