#include <bits/stdc++.h>
using namespace std;
long long int k = 1000000007;
long long int sumXOR(long long int arr[], long long int n) {
  long long int sum = 0;
  for (int i = 0; i < 100000000; i++) {
    long long int zc = 0, oc = 0;
    unsigned long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = ((oc % k) * ((zc % k) * ((1 << i) % k) % k) % k);
    sum = (sum + idsum) % k;
  }
  return sum;
}
int main(int argc, const char* argv[]) {
  long long int n, i, j, l, a;
  cin >> n;
  vector<long long int> h;
  long long int A[400000] = {0};
  for (i = 0; i < n; i++) {
    cin >> A[i];
  }
  l = sumXOR(A, n);
  cout << (l % k) << endl;
  return 0;
}
