#include <bits/stdc++.h>
using namespace std;
int f(long long x) {
  int cnt = 0;
  while (x) {
    cnt += (x & 1);
    x /= 2;
  }
  return cnt;
}
const int N = 120;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> all;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    all.push_back(f(x));
  }
  vector<int> pref;
  pref.push_back(all.front());
  for (int i = 1; i < n; i++) {
    pref.push_back(pref.back() + all[i]);
  }
  int odd = 0, even = 1;
  for (auto i : pref) {
    if (i & 1)
      odd++;
    else
      even++;
  }
  long long ans =
      ((long long)odd * (odd - 1)) / 2 + ((long long)even * (even - 1)) / 2;
  for (int l = 0; l < n; l++) {
    int sum = 0;
    int maxi = 0;
    for (int r = l, i = 0; i < N && r < n; r++, i++) {
      sum += all[r];
      maxi = max(maxi, all[r]);
      if (sum % 2 == 0 && 2 * maxi > sum) ans--;
    }
  }
  cout << ans << "\n";
}
