#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  int tmp;
  long long ze[300000] = {}, on[300000] = {};
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if ((long long)1 << j & a[i])
        on[j]++;
      else
        ze[j]++;
    }
  }
  for (int j = 0; j < 60; j++) {
    long long mo = ((long long)1 << j) % 1000000007;
    ans += ze[j] * on[j] * mo;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
