#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
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;
}
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
long long modMult(long long a, long long b, long long m) {
  long long res = 0;
  long long exp = a % m;
  while (b) {
    if (b & 1) {
      res += exp;
      if (res > m) res -= m;
    }
    exp <<= 1;
    if (exp > m) exp -= m;
    b >>= 1;
  }
  return res;
}
long long powMod(long long a, long long b, long long m) {
  long long res = 1;
  long long exp = a % m;
  while (b) {
    if (b & 1) res = modMult(res, exp, m);
    exp = modMult(exp, exp, m);
    b >>= 1;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<unsigned long long> vec(n);
  vector<unsigned long long> reg(100, 0);
  for (int i = 0; i < (int)(n); i++) cin >> vec[i];
  for (int i = 0; i < (int)(n); i++) {
    unsigned long long k = vec[i];
    for (ll j = 60; j >= 0; j--) {
      if (pow(2, j) <= vec[i]) {
        reg[j]++;
        vec[i] -= pow(2, j);
      }
    }
  }
  unsigned long long res = 0;
  for (int i = 0; i < (int)(61); i++) {
    res += (ll)pow(2, i) * (reg[i]) * (n - reg[i]);
    res %= MOD;
  }
  cout << res % MOD << endl;
}
