#include <bits/stdc++.h>
const int MAXN = 3e5 + 7;
int t[MAXN], sum[MAXN][2], pre[MAXN];
long long ans = 0;
inline long long lowbit(long long x) { return x & (-x); }
int main(int argc, char *argv[]) {
  int n;
  scanf("%d", &n);
  long long a;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a);
    int cnt = 0;
    while (a) a -= lowbit(a), cnt++;
    t[i] = cnt;
    pre[i] = pre[i - 1] + t[i];
  }
  for (int i = n; i >= 1; i--) {
    sum[i][1] = sum[i + 1][1];
    sum[i][0] = sum[i + 1][0];
    sum[i][pre[i] & 1]++;
  }
  for (int i = 1; i <= n; i++) {
    int right = std::min(n, i + 60);
    int max = t[i];
    for (int j = i + 1; j <= right; j++) {
      max = std::max(max, t[j]);
      if (pre[j] - pre[i - 1] - max >= max and !((pre[j] - pre[i - 1]) & 1))
        ans++;
    }
    ans += sum[right + 1][pre[i - 1] & 1];
  }
  printf("%lld\n", ans);
  return 0;
}
