#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    long long c = 0;
    while (x > 0) {
      if (x & 1) c++;
      x /= 2;
    }
    a[i] = c;
  }
  long long even = 1, odd = 0, sum = 0;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    sum += a[i];
    if (sum & 1)
      ans += odd;
    else
      ans += even;
    long long sum1 = 0, maxx = 0;
    for (long long j = i + 1 - 1; j >= max(0LL, i - 70); j--) {
      sum1 += a[j];
      maxx = max(maxx, a[j]);
      if ((sum1 & 1) == 0 && 2 * maxx > sum1) ans--;
    }
    if (sum & 1)
      odd++;
    else
      even++;
  }
  cout << ans;
  return 0;
}
