#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int cntOne[61];
  cin >> n;
  for (int i = 0; i < 61; i++) {
    cntOne[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    long a;
    cin >> a;
    for (int j = 0; j < 61; j++) {
      cntOne[j] += (a >> j) & 1;
    }
  }
  long ans = 0;
  for (int i = 0; i < 61; i++) {
    long pattern = cntOne[i] * (n - cntOne[i]) % 1000000007;
    long incre = pow(2, i);
    ans = (ans + (incre % 1000000007 * pattern % 1000000007)) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
