#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
void solve(long long N, std::vector<long long> A) {
  vector<long long> zeros(60, 0);
  vector<long long> ones(60, 0);
  for (int i = 0; i < N; i++) {
    for (long long j = 0; j < 60; j++) {
      if ((A[i] >> j & 1) == 1) {
        ones[j]++;
      } else {
        zeros[j]++;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    if (ones[i] == 0 || zeros[i] == 0) {
      continue;
    }
    long long res = (ones[i] * zeros[i]) << i;
    res %= MOD;
    ans += res;
    ans %= MOD;
  }
  cout << ans << 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;
}
