#include <bits/stdc++.h>
using namespace std;
long a[66], b[66];
int main() {
  int n, p = 1e9 + 7;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long A;
    scanf("%ld", &A);
    for (int j = 0; j < 60; j++) (A & 1l << j ? a[j] : b[j])++;
  }
  long r = 0;
  for (int j = 0; j < 60; j++) (r += a[j] * b[j] % p * (1l << j)) %= p;
  cout << r << endl;
  return 0;
}
