#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll mod = 1000000007;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  ll c[100];
  for (int i = 0; i < 100; i++) c[i] = 0;
  sort(a, a + n);
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1) c[i]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ll x = 1;
    for (int j = 0; j < i; j++) x *= 2 % mod;
    ans += c[i] * (n - c[i]) * x % mod;
    ans %= mod;
  }
  ans %= mod;
  cout << ans << endl;
  return 0;
}
