#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long mod = 1e9 + 7;
long long n, ans = 0, cnt[64] = {0}, a[N], num[64] = {0}, mx = 0;
void split(long long x) {
  long long p = 0;
  while (x) {
    if (x % 2) cnt[p]++;
    p++;
    x /= 2;
  }
  mx = max(mx, p);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], split(a[i]);
  for (int i = 1; i <= n; i++) {
    for (long long j = 0; j < mx; j++) {
      if (a[i] & (1LL << j))
        num[j] += n - cnt[j];
      else
        num[j] += cnt[j];
    }
  }
  for (long long i = 0; i <= 60; i++) {
    num[i + 1] += num[i] / 2;
    if (num[i] % 2) ans = (ans + (1LL << i)) % mod;
  }
  cout << ans / 2;
  return 0;
}
