#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)(1e6) + 322;
const long long inf = (long long)(1e18) + 123;
const long long mod = (long long)(1e9) + 7;
const double EPS = 1e-9;
long long cnt[111];
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    for (long long j = 0; j < 61; ++j) {
      if ((x >> j) & 1) cnt[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 61; ++i) {
    long long num = ((cnt[i]) * (n - cnt[i])) % mod;
    ans = (ans + ((1ll << i) * num) % mod) % mod;
  }
  cout << ans;
  return 0;
}
