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