#include <bits/stdc++.h>
using namespace std;
long long cnt[64] = {};
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long A[300010];
  for (long long i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 62; j++) {
      if (A[i] & (1LL << j)) cnt[j]++;
    }
  }
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 62; j++) {
      if (!(A[i] & (1LL << j))) continue;
      long long k = (1LL << j);
      if (A[i] & (1LL << j)) cnt[j]--;
      long long remain = (N - 1) - cnt[j];
      ans = (ans + k * remain) % 1000000007;
      if (A[i] & (1LL << j)) cnt[j]++;
    }
  }
  cout << ans << endl;
  return 0;
}
