#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long A[N], ans = 0;
  int one[60] = {}, count = 0, amari;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < N; j++) {
      one[i] += A[j] % 2;
      A[j] = A[j] / 2;
    }
  }
  for (int i = 0; i < 60; i++) {
    if (one[i] == 0) continue;
    ans += one[i] * (N - one[i]) * pow(2, i);
    ans = ans % 1000000007;
  }
  cout << ans << endl;
}
