#include <bits/stdc++.h>
using namespace std;
unsigned long long A[1000000];
unsigned long long A0[100];
unsigned long long A1[100];
int main(void) {
  int N;
  cin >> N;
  for (unsigned int i = 0; i < 61; i++) {
    A0[i] = 0;
    A1[i] = 0;
  }
  for (unsigned long long i = 0; i < N; i++) {
    cin >> A[i];
    for (unsigned int j = 0; j < 61; j++) {
      if (((A[i] >> j) & 1ULL) == 0) {
        A0[j]++;
      } else {
        A1[j]++;
      }
    }
  }
  unsigned long long ans = 0;
  for (unsigned int j = 0; j < 61; j++) {
    ans += A0[j] * A1[j] * (1ULL << j);
  }
  ans = ans % 1000000007ULL;
  cout << ans << endl;
  return 0;
}
