#include <bits/stdc++.h>
using namespace std;
long long a[300010];
long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long fac = 1, ans = 0, check = 1;
  for (long long j = 0; j < 61; j++) {
    long long c_1 = 0, c_0 = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & check)
        c_1++;
      else
        c_0++;
    }
    ans %= MOD;
    ans += (c_1 % MOD) * (c_0 % MOD) * (fac % MOD);
    fac %= MOD;
    fac *= 2;
    check *= 2;
  }
  cout << ans;
}
