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