#include <bits/stdc++.h>
using namespace std;
namespace mine {
__int128 qread() {
  __int128 ans = 0, f = 1;
  char c = getchar();
  while (c < '0' or c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
  return ans * f;
}
void write(__int128 num) {
  if (num < 0) putchar('-'), num = -num;
  if (num >= 10) write(num / 10);
  putchar('0' + num % 10);
}
void write1(__int128 num) {
  write(num);
  putchar(' ');
}
void write2(__int128 num) {
  write(num);
  putchar('\n');
}
template <typename T>
void chmax(T &x, const T y) {
  x = (x > y ? x : y);
}
template <typename T>
void chmin(T &x, const T y) {
  x = (x < y ? x : y);
}
__int128 gcd(__int128 x, __int128 y) { return y ? gcd(y, x % y) : x; }
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
int mm(const int x) { return x >= MOD ? x - MOD : x; }
template <typename T>
void add(T &x, const int &y) {
  x = (x + y >= MOD ? x + y - MOD : x + y);
}
__int128 qpower(__int128 x, __int128 e, int mod = MOD) {
  __int128 ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % mod;
    x = x * x % mod;
    e >>= 1;
  }
  return ans;
}
__int128 invm(__int128 x) { return qpower(x, MOD - 2); }
const int N = 3e5 + 10;
int is1[100];
__int128 a[N];
void main() {
  int n = qread();
  for (int i = (1), I = (n); i <= I; i++) {
    a[i] = qread();
    for (int t = (0), I = (60); t <= I; t++)
      if (a[i] & (1ll << (t))) is1[t]++;
  }
  __int128 ans = 0;
  for (int t = (0), I = (60); t <= I; t++) {
    int x = is1[t], y = n - x;
    ans += 1ll * x * y % MOD * ((1ll << (t)) % MOD) % MOD, ans %= MOD;
  }
  write(ans);
}
};  // namespace mine
signed main() {
  srand(time(0));
  mine::main();
}
