#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
ll sumXOR(ll arr[], int n) {
  ll sum = 0;
  for (int i = 0; i < 64; i++) {
    int zc = 0, oc = 0;
    ll idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = ((oc * zc) % mod * (1LL << i) % mod) % mod;
    sum += idsum, sum %= mod;
  }
  return sum;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  ll a[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << sumXOR(a, n) << endl;
}
