#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<long long> A;
int main() {
  long long N;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(), A.end(), greater<long long>());
  long long keta = (long long)log2(A[0]) + 1;
  vector<long long> bi(60, 0);
  for (long long i = 0; i < N; i++) {
    long long tmp = A[i];
    long long j = 0;
    while (tmp != 0) {
      if (tmp % 2 == 1) bi[j]++;
      tmp /= 2;
      j++;
    }
  }
  long long ans = 0, p = 1;
  for (long long i = 0; i < keta; i++) {
    ans = (ans + (p * (bi[i] * (N - bi[i])) % MOD) % MOD) % MOD;
    p = (p * 2) % MOD;
  }
  cout << ans << endl;
  return 0;
}
