#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long a[300000];
long long cnt[64];
int main() {
  int n;
  long long ans = 0;
  long long s = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  fill(cnt, cnt + 64, 0LL);
  for (int i = 0; i < n; i++) {
    for (long long j = 0; j < 61; j++) {
      if (a[i] & (1LL << j)) cnt[j]++;
    }
  }
  for (int i = 0; i < 61; i++) {
    long long tmp = (1LL << (long long)i) * cnt[i];
    tmp %= MOD;
    tmp *= ((long long)n - cnt[i]);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
