#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  vector<long> B(60, 0);
  for (int i = 0; i < N; i++) {
    long a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      B[j] += (a & 1);
      a /= 2;
    }
  }
  long ans = 0, t = 1;
  for (int i = 0; i < 60; i++) {
    ans = (ans + (((B[i] * (N - B[i])) % 1000000007) * t) % 1000000007) %
          1000000007;
    t *= 2;
  }
  cout << ans;
}
