#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
long long mod = (long long)1e9 + 7;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  long long arr[n], freq[60] = {};
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    long long x = arr[i], j = 59;
    while (x) {
      freq[j--] += (x % 2);
      x >>= 1;
    }
  }
  long long res = 0;
  for (int i = 59; i >= 0; i--) {
    long long x = (n - freq[i]) * freq[i];
    res += (x * power(2, 59 - i)) % mod;
  }
  cout << res % mod << endl;
  return 0;
}
