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