#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long sumXOR(long long arr[], int n) {
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (1ll * oc * zc * ((1ll << i) % MOD)) % MOD;
    sum += (idsum % MOD);
  }
  return sum % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << sumXOR(a, n);
}
