#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int n1[60];
  int n0[60];
  for (int i = 0; i < 60; i++) {
    n1[i] = n0[i] = 0;
    for (int j = 0; j < N; j++) {
      if (long long int(A[j] >> i) & 1) {
        n1[i]++;
      } else {
        n0[i]++;
      }
    }
  }
  long long int ans = 0;
  for (int i = 0; i < 60; i++) {
    ans +=
        (long long int(1 << i) % long long int(1000000000 + 7)) * n1[i] * n0[i];
  }
  cout << ans % long long int(1000000000 + 7) << endl;
}
