#include <bits/stdc++.h>
using namespace std;
int n;
long long a[300100], he, mi, MOD = 1000000007;
bool wei[300100][80];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    he += a[i];
    he %= MOD;
    int cur = 0;
    while (a[i]) {
      wei[i][cur] = (a[i] & 1);
      a[i] /= 2LL;
      cur++;
    }
  }
  he *= (n - 1);
  he %= MOD;
  long long powe = 1LL;
  for (int i = 0; i <= 70; i++) {
    int cnt = 0;
    for (int j = 1; j <= n; j++) cnt += wei[j][i];
    if (cnt == 0) continue;
    mi = (mi + (((long long)(cnt) * (long long)(cnt - 1)) % MOD * powe) % MOD) %
         MOD;
    powe *= 2LL;
    powe %= MOD;
  }
  he -= mi;
  he += MOD;
  he %= MOD;
  cout << he << endl;
  return 0;
}
