#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void solve(int N, std::vector<long long> A) {
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    long long zero_count = 0;
    long long one_count = 0;
    for (int j = 0; j < (N); ++j) {
      bitset<60> s(A[j]);
      if (s.test(i)) {
        one_count++;
      } else {
        zero_count++;
      }
    }
    ans += zero_count * one_count * modpow(2, i, MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  int N;
  cin >> N;
  std::vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  solve(N, std::move(A));
  return 0;
}
