#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long oo = 1e9 + 10;
const int Max = 1e6 + 10;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
inline char gc() {
  static char now[1 << 16], *S, *T;
  if (T == S) {
    T = (S = now) + fread(now, 1, 1 << 16, stdin);
    if (T == S) return EOF;
  }
  return *S++;
}
inline long long read() {
  register long long x = 0, f = 1;
  char ch = gc();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = gc();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = gc();
  }
  return (f == 1) ? x : -x;
}
void solve() {
  long long n, t;
  cin >> n;
  long long a[60] = {0};
  int mx = 0;
  for (int i = 0; i < n; i++) {
    t = read();
    int cnt = 0;
    while (t) {
      if (t & 1) a[cnt]++;
      t >>= 1;
      cnt++;
    }
    mx = max(mx, cnt);
  }
  long long ans = 0;
  for (long long i = 0; i < mx; i++) {
    ans += (1LL << i) % mod * (a[i] * (n - a[i]) % mod);
    ans %= mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
