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