#include <bits/stdc++.h>
using namespace std;
const long mod = 1e9 + 7;
const int size = 1e5;
const int inf = 1e9;
int main() {
  int N;
  cin >> N;
  long A[N];
  int cnt[60][2] = {};
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1l << j))
        cnt[j][1]++;
      else
        cnt[j][0]++;
    }
  }
  long ans = 0;
  long temp;
  for (int i = 0; i < 60; i++) {
    temp = (cnt[i][0] * cnt[i][1]) % mod;
    for (int j = 0; j < i; j++) (temp *= 2) %= mod;
    (ans += temp) %= mod;
  }
  cout << ans << endl;
}
