#include <bits/stdc++.h>
using namespace std;
long long n;
const long long N = 3e5 + 43;
long long a[N];
long long pref[N][2];
long long cnt[N];
inline void input() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  pref[0][0] = 1;
  for (long long i = 1; i <= n; ++i) {
    cnt[i] = cnt[i - 1] + __builtin_popcount(a[i]);
    pref[i][0] = pref[i - 1][0];
    pref[i][1] = pref[i - 1][1];
    pref[i][cnt[i] & 1]++;
  }
}
void solve() {
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    if ((cnt[i] & 1) == 0 && i == 1) continue;
    ans += pref[i - 1][cnt[i] & 1];
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  solve();
  return 0;
}
