#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = (0); i < (N); ++i) cin >> A[i];
  ll ans = 0;
  for (int i = (0); i < (60); ++i) {
    int z = 0, o = 0;
    for (int j = (0); j < (N); ++j)
      if (A[j] >> i & 1)
        o++;
      else
        z++;
    ans = (ans + z * o * (1LL << i)) % 1000000007;
  }
  cout << ans << endl;
}
