#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  ll sum = 0;
  ll bin = 1;
  for (int j = 0; j < 62; j++) {
    int cnt_one = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] >> j & 1) cnt_one++;
    }
    sum += bin * cnt_one * (n - cnt_one);
    sum %= mod;
    bin *= 2;
    bin %= mod;
  }
  cout << sum << endl;
}
