#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, fu = 0;
  char ch = getchar();
  for (; ch < 48 || ch > 57; ch = getchar()) fu |= (ch == '-');
  for (; ch > 47 && ch < 58; ch = getchar()) x = x * 10 + ch - '0';
  return fu ? -x : x;
}
int n, cnt[300005][2];
int getone(long long x) {
  int R = 0;
  for (; x; x -= (x & -x)) R++;
  return R;
}
long long a[300005], ans;
int main() {
  n = read(), cnt[0][0] = 1;
  for (int i = 1, sum = 0; i <= n; cnt[i][sum]++, i++) {
    a[i] = read(), a[i] = getone(a[i]);
    sum = sum ^ (a[i] & 1), ans += cnt[i - 1][sum];
    for (long long s = 0, mx = 0, j = i; j > 0 && i - j + 1 < 65; j--)
      s += a[j], mx = max(mx, a[j]), ans -= ((s & 1) == 0 && (mx << 1) > s);
    cnt[i][0] = cnt[i - 1][0], cnt[i][1] = cnt[i - 1][1];
  }
  printf("%I64d\n", ans);
  return 0;
}
