#include <bits/stdc++.h>
using namespace std;
long long a[300005];
long long MOD = 1e9 + 7;
long long pow2[64];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  pow2[0] = 1;
  for (int i = 1; i < 61; i++) pow2[i] = pow2[i - 1] * 2 % MOD;
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & 1)
        oc++;
      else
        zc++;
      a[j] /= 2;
    }
    idsum = (oc * zc * pow2[i]) % MOD;
    sum = (sum + idsum) % MOD;
  }
  cout << sum << endl;
}
