#include <bits/stdc++.h>
const int N = 100005;
const int mod = 1000000007;
using namespace std;
int n, b[N][65], ans;
long long a[N];
template <typename T>
inline T read() {
  T x = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * w;
}
int main() {
  n = read<int>();
  for (int i = 1; i <= n; i++) {
    a[i] = read<long long>();
    for (int j = 1; j <= 59; j++, a[i] >>= 1) b[i][j] = a[i] & 1;
  }
  for (int sum0 = 0, sum1 = 0, res = 0, tmp = 1, i = 1; i <= 59;
       i++, tmp = tmp * 2 % mod, sum0 = sum1 = res = 0) {
    for (int j = n; j; j--) {
      if (b[j][i])
        res = (res + sum0) % mod, sum1++;
      else
        res = (res + sum1) % mod, sum0++;
    }
    ans = (1ll * ans + 1ll * res * tmp % mod) % mod;
  }
  printf("%d\n", ans);
  return 0;
}
