#include <bits/stdc++.h>
using namespace std;
int main() {
  long long result = 0;
  int N;
  scanf("%d", &N);
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  for (long long i = 0; i < 60; i++) {
    long long i_2 = (long long)1 << i;
    long long num_1 = 0;
    long long num_2 = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & i_2) {
        num_1++;
      } else {
        num_2++;
      }
    }
    result += i_2 * num_1 * num_2;
  }
  printf("%lld", result % (long long)1000000007);
  return 0;
}
