#include <bits/stdc++.h>
using namespace std;
const int mod = 1e+9 + 7;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long suma = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    suma += a[i];
  }
  long long sum = 0;
  for (int i = 0; i < 62; ++i) {
    long long x = 0;
    for (int j = 0; j < n; ++j) {
      if ((a[j] >> i) & 1) ++x;
    }
    sum += x * (n - x) * ((1ll << i) % mod);
  }
  long long ans = sum % mod;
  cout << ans << endl;
}
