#include <bits/stdc++.h>
using namespace std;
int64_t N, A[300000], ans, MOD = 1e9 + 7;
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < 60; ++i) {
    int64_t c0 = 0, c1 = 0, bit = (1L << i);
    for (int i = 0; i < N; ++i) {
      if (A[i] & bit)
        c1++;
      else
        c0++;
    }
    ans += c0 * c1 % MOD * bit % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
