#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  int64_t s = 1;
  int64_t ans = 0;
  int64_t mod = 1e9 + 7;
  for (int i = 0; i < 60; i++) {
    int n1 = 0;
    int n0 = 0;
    for (int j = 0; j < N; j++) {
      if (1 & a[j] >> i)
        n1++;
      else
        n0++;
    }
    int64_t num = n0 * n1 % mod;
    s %= mod;
    ans += num * s % mod;
    ans %= mod;
    s *= 2;
  }
  cout << ans << endl;
}
