#include <bits/stdc++.h>
using namespace std;
long long read_long_long() {
  long long ret = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret;
}
const long MAXN = 300010;
const long long mod = 1000000007;
long n;
long long a[MAXN];
long long zero, one, ans = 0, now;
int main() {
  n = read_long_long();
  register long i, j;
  for (i = 1; i <= n; ++i) a[i] = read_long_long();
  now = 1;
  for (i = 1; i <= 62; ++i) {
    zero = 0;
    one = 0;
    for (j = 1; j <= n; ++j) {
      if (a[j] % 2ll == 0)
        ++zero;
      else
        ++one;
    }
    ans += (now * one) % mod * zero % mod;
    ans %= mod;
    now <<= 1ll;
    for (j = 1; j <= n; ++j) a[j] >>= 1ll;
  }
  cout << ans << endl;
  return 0;
}
