#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  long long ans = 0;
  vector<int> cnt1(61);
  vector<int> cnt0(61);
  for (int i = 0; i < (int)(60 + 1); ++i) {
    for (int j = 0; j < (int)(n); ++j) {
      if (a[j] >> i & 1)
        cnt1[i] += 1;
      else
        cnt0[i] += 1;
    }
    long long dec = (cnt0[i] * cnt1[i]) % MOD;
    dec = (dec * (1LL << i % MOD)) % MOD;
    ans = (ans + dec) % MOD;
  }
  cout << ans << endl;
  return 0;
}
