#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> dp(2, 0);
  vector<long long> pref(n + 1, 0);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    long long ai;
    cin >> ai;
    bitset<64> bits(ai);
    pref[i] = bits.count() + pref[i - 1];
    ans += dp[pref[i] & 1];
    dp[pref[i - 1] & 1]++;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tests = 1;
  for (int _ = 0; (_) < tests; ++(_)) {
    solve();
  }
  return 0;
}
