#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int64_t modpow(int64_t x, int64_t n) {
  x = x % MOD;
  if (n == 0)
    return 1;
  else if (n % 2 == 1) {
    return (x * modpow(x, n - 1)) % MOD;
  } else
    return modpow((x * x) % MOD, n / 2) % MOD;
}
int main() {
  int n;
  cin >> n;
  uint64_t a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  const int keta = 60;
  int bitc[keta];
  for (int i = 0; i < keta; i++) bitc[i] = 0;
  for (int i = 0; i < keta; i++) {
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) bitc[i]++;
    }
  }
  int64_t ansc[keta];
  for (int i = 0; i < keta; i++) ansc[i] = bitc[i] * (n - bitc[i]);
  int64_t ans = 0;
  for (int i = 0; i < keta; i++) {
    int64_t mp = modpow(2, i);
    ans += (mp * (ansc[i] % MOD)) % MOD;
    ans = ans % MOD;
  }
  cout << ans << endl;
  return 0;
}
