#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n), SP(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
    SP[i] = a[i];
    if (i > 0) SP[i] += SP[i - 1];
  }
  vector<int> last(n);
  vector<vector<int>> qs(n);
  long long tot = 0;
  for (int i = 0; i < n; ++i) {
    long long sum = 0, maxim = 0;
    for (int j = i; j < n && sum <= 125; ++j) {
      sum += a[j];
      maxim = max(maxim, a[j]);
      if (j != i && 2 * maxim <= sum && sum % 2 == 0) ++tot;
      last[i] = j;
    }
    if (last[i] + 1 < n) qs[last[i] + 1].push_back(i);
  }
  array<int, 2> ap = {};
  for (int i = n - 1; i >= 0; --i) {
    ++ap[SP[i] % 2];
    for (auto it : qs[i]) {
      if (it == 0)
        tot += ap[0];
      else
        tot += ap[SP[it - 1] % 2];
    }
  }
  cout << tot;
}
