#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<int> zero_count(60, 0);
  vector<int> one_count(60, 0);
  for (int i = 0; i < (N); ++i) {
    long long A;
    cin >> A;
    bitset<60> s(A);
    for (int i = 0; i < (60); ++i) {
      if (s.test(i)) {
        one_count[i]++;
      } else {
        zero_count[i]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    ans +=
        zero_count[i] * one_count[i] * modpow((long long)2, (long long)i, MOD);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
