#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[62] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long b[62] = {};
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < 62; i++) {
      if (a[j] & (1 << i)) {
        b[i]++;
      }
    }
  }
  long long ds[62] = {};
  ds[0] = 1;
  long long mod = 1000000007;
  for (int i = 1; i < 62; i++) {
    ds[i] = ds[i - 1] * 2 % mod;
  }
  long long sum = 0;
  long long tmp;
  for (int i = 0; i < 62; i++) {
    tmp = b[i] * (n - b[i]) * ds[i];
    sum += tmp % mod;
  }
  cout << sum << endl;
}
