#include <bits/stdc++.h>
using namespace std;
long long num_ones[60];
int main() {
  long long N;
  cin >> N;
  memset(num_ones, 0, sizeof(num_ones));
  vector<long long> A;
  long long a, k, cnt;
  for (long long i = 0; i < N; i++) {
    cin >> a;
    k = a;
    cnt = 0;
    while (k) {
      num_ones[cnt] += k % 2;
      cnt++;
      k /= 2;
    }
    A.push_back(a);
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = 0; j < (long long)60; j++) {
      if (A[i] % 2 == 0) {
        ans = (ans + ((long long)1 << j) * num_ones[j]) % (long long)1000000007;
      } else {
        num_ones[j] -= 1;
        ans = (ans + ((long long)1 << j) * (N - i - 1 - num_ones[j])) %
              (long long)1000000007;
      }
      A[i] /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}
