#include <bits/stdc++.h>
using namespace std;
long long sumXOR(long long arr[], long long n) {
  long long mod = 1000000007;
  long long sum = 0;
  for (long long i = 0; i < 64; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = oc * zc * ((long long)1 << i);
    sum += idsum % mod, sum %= mod;
  }
  return sum;
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << sumXOR(a, n) % (long long)(1e9 + 7);
}
