#include <bits/stdc++.h>
using namespace std;
uint64_t MOD = 1000000007;
int main() {
  int64_t N, ans = 0, e = 1;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; i++) cin >> A.at(i);
  for (int64_t i = 0; i <= 60; i++) {
    int64_t one = 0, zero = 0;
    for (int64_t j = 0; j < N; j++) (A.at(j) & (1LL << i)) ? one++ : zero++;
    ans = ans + ((one * zero) % MOD) * e % MOD;
    e *= 2;
  }
  cout << ans % MOD << endl;
}
