#include <bits/stdc++.h>
using namespace std;
const int N = 300010, mod = 1e9 + 7;
long long ans = 0;
long long a[N];
int main() {
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < 60; i++) {
    long long x = 0;
    for (int j = 1; j <= n; j++)
      if (a[j] >> i & 1) x++;
    long long now = x * (n - x) % mod;
    now = now * (1ll << i) % mod;
    ans += now;
    ans %= mod;
  }
  printf("%lld", ans);
  return 0;
}
