#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
ll mod_pow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int one[64];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < (N); i++) {
    ll temp;
    cin >> temp;
    for (int j = 0; j < (60); j++) {
      if (temp << j & 1) one[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (60); i++) {
    ll temp = (one[i] * (N - one[i]) % 1000000007) * mod_pow(2, i, 1000000007) %
              1000000007;
    ans = (ans + temp) % 1000000007;
  }
  cout << ans << endl;
}
