#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long sumXOR(long long arr[], int n) {
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    unsigned 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 = (oc * zc * (1 << i));
    sum += idsum % mod;
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long zor = sumXOR(a, n);
  cout << zor << endl;
}
