#include <bits/stdc++.h>

using namespace std;

int main() {
  int mod = 1e9 + 7;
  int n;
  cin >> n;
  long long a[n];
  for (auto &x: a) {
    cin >> x;
  }
  long long ans = 0;
  long long bit = 1;
  for (auto i = 0; i < 60; ++i) {
    long long one = 0;
    for (auto x: a) {
      if (x & bit) one++;
    }
    ans += bit % mod * one % mod * (n - one) % mod;
    ans %= mod;
    bit <<= 1;
  }
  cout << ans << endl;
}
