#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < (n); ++i) ans = (ans + a[i]) % MOD;
  ans = (ll)ans * (n - 1) % MOD;
  vector<int> bc(60, 0);
  for (int i = 0; i < (n); ++i)
    for (int bi = 0; bi < (60); ++bi) {
      if (a[i] & 1LL << bi) ++bc[bi];
    }
  for (int bi = 0; bi < (60); ++bi) {
    ans =
        (((ll)ans - bc[bi] * (bc[bi] - 1) % MOD * ((1LL << bi) % MOD)) % MOD) %
        MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
