#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int mod = 1000000007;
const int inf = 1e9;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int ddx[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int ddy[8] = {0, 1, -1, 0, 1, -1, 1, -1};
long long modpow(long long n, long long k) {
  long long rtn = 1;
  while (k > 0) {
    if (k & 1) rtn = rtn * n % mod;
    n = n * n % mod;
    k >>= 1;
  }
  return rtn;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    int n0 = 0;
    int n1 = 0;
    for (auto e : a) {
      if (1 & (e >> i))
        n1++;
      else
        n0++;
    }
    ans += (((n0 * n1) % mod) * modpow(2, i)) % mod;
    ans %= mod;
  }
  cout << ans % mod << endl;
}
