#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void solve() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  for (int d = 61; d >= 0; --d) {
    long long mask = (1LL << d);
    int cnt = 0;
    for (int i = 0; i < (N); ++i)
      if (mask & A[i]) ++cnt;
    ans += mask * cnt * (N - cnt);
    ans %= MOD;
  }
  cout << ans << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
