#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 50;
const int mod = 1e9 + 7;
long long qp(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
template <class T>
inline bool scan(T& ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
int n;
long long a[maxn];
int main(int argc, char* argv[]) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  long long res = 0;
  for (int i = 0; i < 60; ++i) {
    int c1 = 0, c0 = 0;
    for (int j = 1; j <= n; ++j) {
      if (a[j] >> i & 1) {
        c1++;
      } else
        c0++;
    }
    res += c1 * c0 % mod * ((1ll << i) % mod) % mod;
    res %= mod;
  }
  printf("%lld\n", res);
  return 0;
}
