#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;
const double EPS = 1e-9;
signed main() {
  long long MOD = (long long)1e9 + 7;
  long long x, p, n;
  cin >> n;
  long long arr[60] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  long long ite = 0;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    while (x != 0) {
      if (x % 2 == 1) {
        arr[ite]++;
      }
      x = x >> 1;
      ite++;
    }
    ite = 0;
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    ans += (arr[i] * (n - arr[i]) * (1LL << i) % MOD) % MOD;
  }
  cout << (ans % MOD) << endl;
  return 0;
}
