#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;
int N;
ll A[300100];
int is_true[70];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    for (int j = 0; j < 61; j++) {
      if (A[i] & (ll(1) << j)) {
        is_true[j]++;
      }
    }
  }
  ll ans = 0;
  for (int j = 0; j < 61; j++) {
    ll b = is_true[j] * (N - is_true[j]) % MOD;
    ll c = (1LL << j) % MOD;
    ll d = (b * c) % MOD;
    ans += d;
    ans %= MOD;
  }
  cout << ans << endl;
}
