#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const long long LINF = 1e18;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long r[60];
  r[0] = 1;
  for (int i = 1; i < 60; i++) {
    r[i] = 2 * r[i - 1];
    r[i] %= MOD;
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long cnt = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & 1) cnt++;
      a[j] /= 2;
    }
    long long t = cnt * (n - cnt);
    t %= MOD;
    ans += (cnt * (n - cnt) * r[i]) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
