#include <bits/stdc++.h>
using namespace std;
const int INTINF = 1 << 29;
const long long LLINF = 1LL << 61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DY[8] = {1, 0, -1, 0, 1, -1, 1, -1};
long long int sumXOR(long long arr[], int n) {
  long long int sum = 0;
  for (int i = 0; i < 64; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = ((oc % MOD) * (zc % MOD) * (1 << i)) % MOD;
    sum += idsum;
  }
  return sum % MOD;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int sum = 0;
  long long arr[400000] = {};
  int n;
  cin >> n;
  int a;
  for (int i = (0); i < (n); ++i) {
    cin >> a;
    arr[i] = a;
  }
  sum = sumXOR(arr, n);
  cout << sum << endl;
}
