#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;
int modPow(long long a, long long n) {
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  long long t = modPow(a, n / 2);
  return (t * t) % MOD;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int j = 0; j < (61); j++) {
    int cnt = 0;
    for (int i = 0; i < (n); i++) {
      cnt += (a[i] >> j) & 1;
    }
    ans +=
        (((long long)pow((long long)2, (long long)j) % MOD) * (n - cnt) * cnt) %
        MOD;
    ans %= MOD;
  }
  cout << (ans) << endl;
  return 0;
}
