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