#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;
  }
  for (int i = 0; i < (60); i++) {
    di[i] = 0;
  }
}
void solve() {
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (60); j++) {
      di[j] += (A[i] >> j) & 1;
    }
  }
  ll d = 1;
  for (int j = 0; j < (60); j++) {
    ll p = di[j] * (N - di[j]);
    p %= MOD;
    ll a = (p * d);
    a %= MOD;
    ret += a;
    ret %= MOD;
    d *= 2;
    d %= MOD;
  }
  cout << (ret) << endl;
}
int main(void) {
  input();
  solve();
}
