#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
inline bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> pct(N);
  for (long long a, i = 0; i < N; ++i) {
    cin >> a;
    pct[i] = __builtin_popcountll(a);
  }
  int odd = 0, even = 1, sum = 0;
  long long ans = 0;
  for (int i = N - 1; i >= 0; --i) {
    int cur_sum = 0, max_pct = 0, cur_ans = 0;
    for (int j = i; j < min(i + 61, N); ++j) {
      cur_sum += pct[j];
      uax(max_pct, pct[j]);
      if (max_pct > cur_sum - max_pct && cur_sum % 2 == 0) --cur_ans;
    }
    sum += pct[i];
    if (sum % 2 == 1) {
      cur_ans += odd;
      ++odd;
    } else {
      cur_ans += even;
      ++even;
    }
    ans += cur_ans;
  }
  cout << ans << '\n';
}
