#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 30;
const double PI = acos(-1);
ll mod = 1e9 + 7;
long long modpow(long long a, long long n, long long mod = (1LL << 62)) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  ll n;
  ll ans = 0LL;
  cin >> n;
  ll a;
  int c = 0;
  map<int, int> dis;
  for (int i = 0, i_len = (int)(n); i < i_len; i++) {
    c = 0;
    cin >> a;
    while (a != 0) {
      dis[c] += (a % 2LL);
      a /= 2LL;
      c++;
    }
  }
  for (auto itr = (dis).begin(), itr_fin = (dis).end(); itr != itr_fin; itr++) {
    ans +=
        modpow(2, itr->first) * (itr->second) % mod * (n - itr->second) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
