#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long N = 3e5 + 100;
long long long long cnt[62];
long long long long mod = 1e9 + 7;
int32_t main() {
  long long long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long long long x;
    cin >> x;
    for (long long j = 0; j <= 60; j++) {
      if ((x & ((long long long long)1 << j)) != 0) {
        cnt[j]++;
      }
    }
  }
  long long long long ans = 0;
  for (long long i = 0; i < 61; i++) {
    ans += cnt[i] * (n - cnt[i]) % mod * ((long long long long)1 << i) % mod;
    ans %= mod;
  }
  cout << ans;
}
