#include <bits/stdc++.h>
using namespace std;
int mygcd(int a, int b) {
  if (b == 0) return a;
  return mygcd(b, a % b);
}
int cntBits(long long a) {
  int ret = 0;
  while (a > 0) {
    ret++;
    a /= 2;
  }
  return ret;
}
int cntSetBits(long long a) {
  int ret = 0;
  while (a > 0) {
    if (a % 2 == 1) ret++;
    a /= 2;
  }
  return ret;
}
long long arr[300010];
int main() {
  ios::sync_with_stdio(0);
  long long n, ans = 0, s0 = 1, s1 = 0, sm = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long val;
    cin >> val;
    arr[i] = cntSetBits(val);
  }
  for (int i = n; i >= 1; i--) {
    long long sm1 = 0, mx = 0;
    for (int j = i; j <= n && j < i + 65; j++) {
      sm1 += arr[j];
      mx = max(mx, arr[j]);
      if (mx > sm1 - mx && sm1 % 2 == 0) ans--;
    }
    sm += arr[i];
    if (sm % 2 == 0)
      ans += s0;
    else
      ans += s1;
    if (sm % 2 == 0)
      s0++;
    else
      s1++;
  }
  cout << ans << endl;
  return 0;
}
