#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;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const long long dx[4] = {1, 0, -1, 0};
const long long dy[4] = {0, 1, 0, -1};
const long long INF = 1e9;
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;
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)n; i++) cin >> a[i];
  long long res = 0;
  for (long long i = 0; i < (long long)60; i++) {
    long long zero = 0, one = 0;
    for (long long j = 0; j < (long long)n; j++) {
      if (a[j] & (1LL << i))
        one++;
      else
        zero++;
    }
    long long add = (one * zero * modpow(2, i, MOD)) % MOD;
    res += add;
    res %= MOD;
  }
  cout << res << endl;
}
