#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
const long long MOD = 1000000007;
long long powmod(long long x, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret *= x;
      ret %= MOD;
      n -= 1;
    } else {
      x *= x;
      x %= MOD;
      n >>= 1;
    }
  }
  return ret;
}
signed main() {
  int n;
  cin >> n;
  int num0[66], num1[66];
  for (int i = 0; i < (66); i++) num0[i] = num1[i] = 0;
  for (int i = 0; i < (n); i++) {
    long long a;
    cin >> a;
    for (long long j = 0; j < 66; j++) {
      if (a & (1ull << j))
        num1[j]++;
      else
        num0[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < (63); i++) {
    long long x = num0[i] * num1[i];
    x %= MOD;
    ans += (powmod(2, i) * x) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << endl;
}
