#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long POW(long long x, long long y) {
  long long ans = 1;
  long long base = x;
  while (y) {
    if (y & 1) {
      ans *= base % MOD;
      ans %= MOD;
    }
    base = base * base;
    base %= MOD;
    y = y >> 1;
  }
  return ans % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, i, j, k, t, temp;
  cin >> n;
  long long ans = 0, one = 1;
  int ones[62] = {0}, zeroes[62] = {0};
  for (i = 0; i < n; i++) {
    cin >> j;
    for (t = 0; t < 62; t++) {
      if ((j & (one << t)) == 0) {
        zeroes[t]++;
      } else {
        ones[t]++;
      }
    }
  }
  for (i = 0; i < 62; i++) {
    ans += (POW(2, i) * ((zeroes[i] * ones[i]) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << (ans + 5 * MOD) % MOD << endl;
  return 0;
}
