#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1e18 + 5;
const long long M = 1000000007;
vector<long long> fac(10000000);
vector<long long> ifac(10000000);
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % M;
    x = x * x % M;
    n = n >> 1;
  }
  return ans;
}
long long comb(long long a, long long b) {
  if (a == 0 && b == 0) return 1;
  if (a < b || a < 0) return 0;
  long long tmp = ifac[a - b] * ifac[b] % M;
  return tmp * fac[a] % M;
}
void init_comb() {
  fac[0] = 1;
  ifac[0] = 1;
  for (long long i = 0; i < 10000000; i++) {
    fac[i + 1] = fac[i] * (i + 1) % M;
    ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M;
  }
}
int main() {
  int N;
  long long A[300000] = {};
  cin >> N;
  init_comb();
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  long long totalcomb = comb(N, 2);
  for (int i = 0; i < 60; i++) {
    long long count_0 = 0;
    for (int j = 0; j < N; j++) {
      if (((A[j] >> i) & 1) == 0) count_0++;
    }
    long long count =
        (totalcomb - comb(count_0, 2) - comb(N - count_0, 2) + 3 * M) % M;
    ans = (ans + count * (long long)pow(2, i)) % M;
  }
  cout << ans << endl;
  return 0;
}
