#include <bits/stdc++.h>
using namespace std;
const long long Mod = (long long)(1e9) + 7;
int n;
int getbit(long long s, int k) { return (s >> k) & 1; }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  vector<long long> bit(70);
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int pos = 0; pos < 60; pos++) {
    long long cnt1 = 0;
    for (int i = 0; i < n; i++)
      if (getbit(a[i], pos)) cnt1++;
    bit[pos] = (long long)(n - cnt1) * cnt1;
  }
  long long mem = 0;
  long long ans = 0;
  long long pw2 = 1;
  for (int i = 0; i < 70; i++) {
    ans = (ans + ((mem + bit[i]) % 2) * pw2) % Mod;
    mem = (mem + bit[i]) / 2;
    pw2 = (pw2 * 2LL) % Mod;
  }
  cout << ans;
  return 0;
}
