#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < 48 || c > 57) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c > 47 && c < 58) {
    x = (x << 1) + (x << 3) + (c & 15);
    c = getchar();
  }
  return x * f;
}
void print(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (!x) {
    putchar('0');
  }
  static char st[30];
  long long stp = 0;
  while (x) {
    st[++stp] = x % 10 ^ 48;
    x /= 10;
  }
  while (stp) {
    putchar(st[stp--]);
  }
  putchar('\n');
}
long long n;
const long long N = 3e5 + 5;
long long a[N];
long long c[N][62];
long long mx = 0;
const long long mod = 1e9 + 7;
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read(), mx = max(mx, a[i]);
  for (long long i = 1; i <= n; i++)
    for (long long j = 0; (1ll << j) <= a[i]; j++)
      if (a[i] & (1ll << j)) c[i][j] = 1;
  long long ans = 0;
  for (long long j = 0; (1ll << j) <= mx; j++) {
    long long tot = 0;
    for (long long i = 1; i <= n; i++) {
      if (c[i][j]) {
        tot++;
      }
    }
    ans = (ans + ((1ll << j) % mod * (tot * (n - tot))) % mod) % mod;
  }
  print(ans);
  return 0;
}
