#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 3e5 + 5;
const int MAXM = 2e5 + 5;
const int MOD = 1e9 + 7;
const int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
const double PI = acos(-1.0);
const double EXP = 1e-8;
long long n;
long long a[MAXN];
int bit[65];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = 0; j < 62; j++)
      if (a[i] & (1ll << j)) bit[j]++;
  }
  long long ans = 0;
  for (int i = 0; i < 62; i++)
    ans = (ans + (bit[i] * (n - bit[i]) * (1ll << i) % MOD)) % MOD;
  cout << ans << endl;
  return 0;
}
