#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, k = 0;
  long long a, S = 0, t, M;
  cin >> n;
  long long v[n + 1], s[2][n + 1];
  s[0][0] = 1;
  s[1][0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    t = 1;
    v[i] = 0;
    while (a > 0) {
      if (a % (2 * t) == t) {
        a -= t;
        v[i]++;
      }
      t *= 2;
    }
    k = (k + v[i] % 2) % 2;
    s[1][i] = s[1][i - 1];
    s[0][i] = s[0][i - 1];
    if (k % 2 == 1) {
      S += s[1][i];
      s[1][i]++;
    } else {
      S += s[0][i];
      s[0][i]++;
    }
  }
  for (int i = 0; i < min(70, n); i++) {
    for (int y = 1; y <= n - i; y++) {
      M = 0;
      k = 0;
      for (int u = y; u <= y + i; u++) {
        M = max(v[u], M);
        k += v[u];
      }
      if (M * 2 > k && k % 2 == 0) {
        S--;
      }
    }
  }
  cout << S;
  return 0;
}
