#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
void solve(long long N, std::vector<long long> A) {
  long long sum = 0;
  long long d = 1;
  for (int i = 0; i < (60); ++i) {
    long long c = 0;
    for (int j = 0; j < N; j++) {
      (A[j] & 1) ? c++ : 1;
      A[j] = A[j] >> 1;
    }
    sum = (sum + (c * (N - c) * d)) % MOD;
    d = 2 * d % MOD;
  }
  cout << sum % MOD << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
