#include <bits/stdc++.h>
const long long maxn = 300005;
long long n, ans;
long long a[maxn], sum[maxn], cnt[2];
inline long long max(long long a, long long b) { return a > b ? a : b; }
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    long long x;
    for (scanf("%lld", &x); x; x >>= 1) a[i] += (x & 1);
  }
  cnt[0]++;
  for (long long i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
    ans += cnt[sum[i] & 1];
    long long maxx = a[i];
    for (long long j = i - 1; j >= i - 65 && j >= 0; j--) {
      if ((sum[i] - sum[j]) % 2 == 0 && sum[i] - sum[j] < 2 * maxx) ans--;
      maxx = max(maxx, a[j]);
    }
    cnt[sum[i] & 1]++;
  }
  printf("%lld\n", ans);
  return 0;
}
