#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
int cnt[maxn];
int S[maxn];
int prefix[maxn];
int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long u;
    scanf("%I64d", &u);
    while (u) {
      cnt[i]++;
      u -= u & -u;
    }
  }
  for (int i = 1; i <= n; i++) S[i] = (S[i - 1] + cnt[i]) & 1;
  for (int i = n; i >= 1; i--) prefix[i] = (prefix[i + 1] + (S[i] & 1));
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int best = 0;
    int tot = 0;
    for (int j = i; j <= n; j++) {
      if (cnt[j] > best) best = cnt[j];
      tot += cnt[j];
      if (best * 2 <= tot && !(tot & 1)) ans++;
      if (tot >= 128) {
        if (S[i - 1] & 1)
          ans += prefix[j + 1];
        else
          ans += n - j - prefix[j + 1];
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
