#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
long long cnt1 = 0;
long long ans = 0;
long long super = 1;
int main() {
  cin >> n;
  a.resize(n);
  for (long long i = 0; i < (n); ++i) cin >> a[i];
  for (long long i = 0; i < (61); ++i) {
    cnt1 = 0;
    cnt1 = 0;
    for (long long j = 0; j < (n); ++j) {
      if (a[j] & (1ll << i)) cnt1++;
    }
    ans += ((cnt1 * (n - cnt1)) % 1000000007) * (super % 1000000007);
    ans %= 1000000007;
    super *= 2;
  }
  cout << (ans) << endl;
}
