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