#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
int main(void) {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long digit = 1;
  for (int i = 0; i < 60; i++) {
    int one = 0, zero = 0;
    for (int j = 0; j < n; j++) {
      if ((1LL << i) & a[j])
        one++;
      else
        zero++;
    }
    long long add = (one * zero) % mod * digit % mod;
    ans = (ans + add) % mod;
    ans %= mod;
    digit *= 2;
    digit %= mod;
  }
  cout << ans << endl;
}
