#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1e9 + 7;
const int MAX = 303030;
LL A[MAX][60], ACUM[MAX][60];
string decimalToBinary(LL n, int d) {
  string ret;
  LL ln = abs(n);
  while (ln) {
    ret = string((ln & 1) ? "1" : "0") + ret;
    ln /= 2;
  }
  while (ret.size() < d) ret = "0" + ret;
  if (n < 0) ret = "-" + ret;
  return ret;
}
int main() {
  int N;
  scanf("%d", &N);
  LL a;
  string s;
  for (int i = 0; i < N; i += 1) {
    scanf("%lld", &a);
    s = decimalToBinary(a, 60);
    for (int j = 0; j < 60; j += 1) A[i][j] = s[j] - '0';
  }
  for (int i = 0; i < N; i += 1)
    for (int j = 0; j < 60; j += 1) ACUM[i + 1][j] = ACUM[i][j] + A[i][j];
  LL ans = 0;
  for (int i = 0; i < 60; i += 1) {
    ans += ((N - ACUM[N][i]) * ACUM[N][i]) << (59 - i);
    ans %= MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
