#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
const int INF = 0x3f3f3f3f, N = 3e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7, two = (mod + 1) / 2;
int n, cnt[N];
ll a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 60; j++)
      if ((a[i] >> j) & 1) cnt[j]++;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 60; j++) {
      if ((a[i] >> j) & 1) {
        ans += (n - cnt[j]) * (1ll << j) % mod;
        ans %= mod;
      } else {
        if (!cnt[j]) continue;
        ans += (cnt[j]) * (1ll << j) % mod;
        ans %= mod;
      }
    }
  }
  ans = ans * two % mod;
  ans = (ans + mod) % mod;
  cout << ans;
  return 0;
}
