#include <bits/stdc++.h>
using namespace std;
long long arr[63];
long long brr[64];
long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  brr[0] = 1;
  for (int i = 1; i < 64; i++) {
    brr[i] = brr[i - 1] * 2;
    brr[i] %= mod;
  }
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    int count = 0;
    while (a) {
      arr[count++] += a % 2;
      a /= 2;
    }
  }
  long long sum = 0;
  for (int i = 0; i < 63; i++) {
    sum += brr[i] * arr[i] * (n - arr[i]);
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
