#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
void solve(long long N, std::vector<unsigned long long> A) {
  long long cnt = 0;
  unsigned long long mask = 1;
  long long ans = 0;
  for (long long(i) = 0; (i) < (61); (i)++) {
    for (long long(j) = 0; (j) < (N); (j)++) {
      if (A[j] & mask) cnt++;
    }
    ans += ((cnt * (N - cnt)) * (mask % MOD) % MOD);
    ans %= MOD;
    cnt = 0;
    mask <<= 1;
  }
  cout << (ans) << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<unsigned long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
