#include <bits/stdc++.h>
using namespace std;
long long modpow(long long x, long long n, long long mod) {
  long long res = 1;
  for (long long i = 0; i < n; i++) {
    res *= x;
    res %= mod;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<long long> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  map<long long, long long> m;
  for (long long i = 0; i <= 61; i++) {
    m[i] = 0;
  }
  for (auto x : v) {
    long long digit = 0;
    while (x >= 1) {
      long long num = x % 2;
      if (num == 1) {
        m[digit]++;
      }
      x = x / 2;
      digit++;
    }
  }
  long long ans = 0;
  long long MOD = 1000000000 + 7;
  for (auto x : m) {
    long long tmp = x.second * (N - x.second);
    tmp = tmp * modpow(2, (long long)x.first, MOD);
    ans += tmp % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
