#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
int main() {
  const i64 MOD = 1e9 + 7;
  int n;
  cin >> n;
  vector<i64> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  i64 sum = 0;
  i64 base = 1;
  for (int i = 0; i < 62; ++i) {
    int cnt[2] = {0};
    for (int j = 0; j < n; ++j) {
      if (a[j] % 2 == 1)
        cnt[1]++;
      else
        cnt[0]++;
      a[j] >>= 1;
    }
    sum += cnt[0] * cnt[1] * base;
    sum %= MOD;
    base = (base * 2) % MOD;
  }
  cout << sum << endl;
  return 0;
}
