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