#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const unsigned long long MOD = 1000000007;
unsigned long long arr[300005], n;
long long sumXOR() {
  long long sum = 0;
  for (unsigned long long i = 0; i < 62; i++) {
    unsigned long long zc = 0, oc = 0;
    long long idsum = 0;
    for (unsigned long long j = 0; j < n; j++) {
      if (!(arr[j] & 1LL))
        zc++;
      else
        oc++;
      arr[j] = (arr[j] >> 1LL);
    }
    idsum = (oc * zc * ((1LL << i) % MOD)) % MOD;
    sum = ((sum % MOD) + (idsum % MOD)) % MOD;
  }
  return sum % MOD;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long ans = 0;
  cin >> n;
  for (unsigned long long i = 0; i < n; ++i) cin >> arr[i];
  cout << sumXOR();
  return 0;
}
