#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long res = 0;
  for (int d = 0; d < 60; ++d) {
    long long n0 = 0, n1 = 0;
    for (int i = 0; i < N; ++i) {
      if ((A[i] >> d) & 1)
        ++n1;
      else
        ++n0;
    }
    long long tmp = (1ll << d) % 10000007;
    long long n = n0 * n1 % 10000007;
    tmp = tmp * n % 10000007;
    res = (res + tmp) % 10000007;
  }
  cout << res << endl;
}
