#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long A, MOD = 1e9 + 7, ans = 0;
  vector<int> c(60);
  for (int i = 0; i < N; i++) {
    cin >> A;
    for (int j = 0; j < 60; j++) {
      if (A & (1LL << j)) c[j]++;
    }
  }
  for (int i = 0; i < 60; i++) {
    ans = (ans + (((1LL << i) * c[i]) % MOD) * (N - c[i])) % MOD;
  }
  cout << ans << "\n";
}
