#include <bits/stdc++.h>
using namespace std;
const int N = 300000 + 10;
const int MOD = 1000000007;
long long a[N];
int main() {
  int res, n, x, y, i, j;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  res = 0;
  for (i = 0; i < 60; i++) {
    x = y = 0;
    for (j = 0; j < n; j++)
      if (a[j] & (1LL << i))
        x++;
      else
        y++;
    res = (res + 1LL * x * y % MOD * (1LL << i) % MOD) % MOD;
  }
  cout << res << endl;
  return 0;
}
