#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long int ll;

const ll mod = 1e9+7;

int main() {
  int n; cin >> n;
  vector<ll> a(n); rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i, 61) {
    ll m = 0, s = (1ll<<i);
    rep(j, n) if (a[j] & s) m++;
    ans += m * (n - m) % mod * (s % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}