#include <bits/stdc++.h>
using namespace std;
int main() {
  long long mod = 1e9 + 7;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long one = 1;
  vector<long long> c(61, 0);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 61; j++) {
      if ((a[i] >> j) & one) c[j]++;
    }
  }
  long long ans = 0;
  for (long long j = 0; j < 61; j++) {
    ans += (c[j] * (n - c[j]) * ((one << j) % mod)) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
