#include <cstdio>

using namespace std;

int cnt[69];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 60; ++i) {
    cnt[i] = 0;
  }
  const int mod = 1'000'000'007;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    ans += x * (n - 1) % mod;
    ans %= mod;
    for (int j = 0; j < 60; ++j) {
      if (x >> j & 1) {
        ++cnt[j];
      }
    }
  }
  for (int i = 0; i < 60; ++i) {
    long long pw = (1LL << (i + 1)) % mod;
    long long tot = (long long)cnt[i] * (cnt[i] - 1) / 2 % mod;
    ans -= pw * tot % mod;
    ans += mod;
    ans %= mod;
  }
  printf("%d\n", (int)ans);
}
