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

int main() {
  int n;
  cin >> n;
  vector<llong> a(n);
  rep(i, n) cin >> a[i];
  const int mod = 1e9 + 7;
  llong ans = 0;
  rep(i, 60) {
    llong tr = 0;
    rep(j, n) if (a[j] >> i & 1) tr++;
    llong now = tr * (n - tr) % mod;
    rep(j, i) now = now * 2 % mod;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}