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