#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long NMAX = 300011;
long long c[NMAX];
signed main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    while (a > 0) {
      if (a & 1) c[i]++;
      a >>= 1;
    }
  }
  long long bad = 0;
  for (long long i = 1; i <= n; i++) {
    long long sum = c[i];
    long long mx = c[i];
    if ((c[i] & 1) == 0) bad++;
    for (long long j = i + 1; j <= min(n, i + 64); j++) {
      sum += c[j];
      mx = max(mx, c[j]);
      if ((sum & 1) == 0 && 2 * mx > sum) bad++;
    }
  }
  long long cnt2 = 1;
  long long cnt1 = 0;
  long long sum = 0;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    sum += c[i];
    if (sum & 1) {
      ans += cnt1;
      cnt1++;
    } else {
      ans += cnt2;
      cnt2++;
    }
  }
  cout << ans - bad;
  return 0;
}
