#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int main() {
  int n, i, j, k, zc, oc;
  cin >> n;
  long long int arr[n], sum = 0, idsum, id = 1, mask;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < 61; i++) {
    zc = oc = 0;
    idsum = 0;
    mask = id << i;
    ;
    for (j = 0; j < n; j++) {
      if (arr[j] & mask)
        oc++;
      else
        zc++;
    }
    idsum = oc * zc * mask;
    sum = (sum + idsum) % mod;
  }
  cout << sum;
}
