#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long fast_exp(long long a, long long b) {
  if (b == 0)
    return 1;
  else {
    long long res = 1;
    res = fast_exp(a, b / 2);
    res = (res * res) % mod;
    if (b % 2 == 1) res = (res * a) % mod;
    return res;
  }
}
const long long N = 1e6;
int main() {
  long long n;
  cin >> n;
  long long ones[60] = {}, zero[60] = {};
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long pos = 0;
    int cur = 60;
    while (cur--) {
      if (a[i] % 2)
        ones[pos]++;
      else
        zero[pos]++;
      a[i] = a[i] / 2;
      pos++;
    }
  }
  long long ans = 0;
  long long p[60] = {};
  p[0] = 1;
  for (long long i = 1; i < 60; i++) p[i] = 2 * p[i - 1];
  for (long long i = 0; i < 60; i++)
    ans = (ans + ones[i] * zero[i] * p[i]) % mod;
  cout << ans << endl;
  return 0;
}
