#include <bits/stdc++.h>
using namespace std;
long long cnt[100][2];
long long n = 0;
long long a[300001];
__int128_t sum = 0;
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long aa = a[i];
    for (long long j = 0; j < 62; j++) {
      cnt[j][aa % 2]++;
      aa /= 2;
    }
  }
  for (long long i = 0; i < n; i++) {
    long long x = 1;
    for (long long j = 0; j < 62; j++) {
      sum += x * (cnt[j][1 - (a[i] % 2)]);
      a[i] /= 2;
      x *= 2;
    }
  }
  cout << (long long)((sum / 2) % 1000000007);
  return 0;
}
