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