#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  long long A[3 * 100000 + 10];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long tmp[60] = {0};
  for (int i = 0; i < 64; i++) {
    tmp[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (((A[i] >> j) & 0x1) == 0x1) {
        tmp[j]++;
      }
    }
  }
  long long sum = 0;
  long long base = N * (N - 1) / 2;
  for (int i = 0; i < 60; i++) {
    if (tmp[i] != 0) {
      sum = (sum + (((long long)((1l << i)) *
                     (tmp[i] * (N - tmp[i]) % (1000000007))))) %
            (1000000007);
    }
  }
  cout << (sum % (1000000007));
  return 0;
}
