#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1e9 + 7);
long long modpow(long long n) {
  if (n == 0) {
    return 1ll;
  }
  long long prev = modpow(n / 2);
  if (n % 2 == 0) {
    return (prev * prev) % MOD;
  } else {
    return (prev * prev * 2) % MOD;
  }
}
int main(int argc, char const *argv[]) {
  long long n;
  cin >> n;
  vector<long long> one(60, 0);
  vector<long long> zero(60, 0);
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    long long a;
    cin >> a;
    for (long long j = (long long)(0); j < (long long)(60); ++j) {
      if (((a >> j) & 1) == 1) {
        one[j]++;
      } else {
        zero[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(60); ++i) {
    ans += (one[i] * zero[i] * modpow(i)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
