#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const long long IINF = 1LL << 62;
const int maxn = 10000005;
long long modexpo(long long a, long long b) {
  long long res = 1LL;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long s[64];
long long us[64];
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long res = 0LL;
  for (int i = 0; i <= 60; i++) {
    int zc = 0, oc = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        zc++;
      else
        oc++;
      a[j] /= 2;
    }
    if (zc != 0 && oc != 0) {
      long long t = (zc * oc) % 1000000007;
      res = (res + ((1LL << i) % 1000000007 * t) % 1000000007) % 1000000007;
      res %= 1000000007;
    }
  }
  cout << res;
}
