#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N + 1);
  for (int i = 0; i < (N); ++i) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long count = 0;
    for (int j = 0; j < N; j++) {
      long long asd = A[j] >> i;
      if ((asd & 1) != 0) {
        count++;
      }
    }
    long long tmp = count * (N - count);
    tmp %= 1000000007;
    ans += pow(2, i) * tmp;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
