#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
const int ARRAY = 100005;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int MOD = 1e9 + 7;
ll N = 0;
ll A[30005];
ll di[60];
ll t;
ll ret = 0;
void input() {
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> t;
    A[i] = t;
  }
}
void solve() {
  for (int j = 0; j < (60); j++) {
    ll x = 0;
    for (int i = 0; i < (N); i++) {
      x += (A[i] >> j) & 1;
    }
    ll p = x * (N - x) % MOD;
    for (int k = 0; k < (j); k++) p = p * 2 % MOD;
    ret += p;
    ret %= MOD;
  }
  cout << (ret) << endl;
}
int main(void) {
  input();
  solve();
}
