#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 7;
__int128 a[maxn];
inline __int128 read() {
  __int128 s = 0, w = 1;
  char ch = getchar();
  while (ch <= '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
inline void write(__int128 x) {
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  int n;
  scanf("%d", &n);
  __int128 s = 0, s1 = 0, s2 = 0;
  for (int i = 0; i < n; i++) a[i] = read();
  for (int i = 0; i <= 60; i++) {
    s1 = s2 = 0;
    for (int j = 0; j < n; j++) {
      if (((a[j] >> i) & 1) == 1)
        s1++;
      else
        s2++;
    }
    s = (s + s1 * s2 * (1ll << i)) % mod;
  }
  write(s);
  return 0;
}
