#include <bits/stdc++.h>
using namespace std;
long long sumXOR(vector<long long> arr) {
  long long sum = 0, n = arr.size();
  for (long long i = 0; i < 61; 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 * (1 << i)) % 1000000007)) % 1000000007;
    sum = (sum + idsum) % 1000000007;
  }
  return sum;
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long sum = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  cout << sumXOR(v) << endl;
}
