#include <bits/stdc++.h>
const long MOD = 1e9 + 7;
using namespace std;
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<long, long>;
using vi = vc<long>;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  long N;
  cin >> N;
  long bkt[61], bkt2[61];
  for (long i = long(0); i < long(61); i++) {
    bkt[i] = 0;
    bkt2[i] = 0;
  }
  long sum = 0;
  long a[N];
  for (long i = long(0); i < long(N); i++) {
    cin >> a[i];
  }
  for (long i = long(0); i < long(61); i++) {
    for (long j = long(0); j < long(N); j++) {
      if ((a[j] >> i) & 1) {
        bkt[i]++;
      } else {
        bkt2[i]++;
      }
    }
    sum = (sum + ((bkt[i] * bkt2[i]) % MOD * (1LL << i) % MOD) % MOD) % MOD;
  }
  cout << sum << endl;
}
