#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1e9 + 7;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int N;
vector<long long> bitcnt(66, 0);
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    long long ina;
    cin >> ina;
    long long bit = 0;
    long long now = 0;
    while (now <= ina) {
      now = ((long long)1 << bit);
      if (ina & now) bitcnt.at(bit)++;
      bit++;
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 65; ++i) {
    ans += modpow(2, (long long)i, MOD) * bitcnt.at(i) * (N - bitcnt.at(i));
    ans %= MOD;
  }
  cout << ans << endl;
}
