#include <bits/stdc++.h>
using namespace std;
long long mo = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  long long cnt = 0, cntb = 0;
  vector<long long> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    cnt = 0;
    cntb = 0;
    for (int j = 0; j < N; j++) {
      ((A[j] >> i) & (long long)1 == (long long)1) ? (cnt++) : (cntb++);
    }
    sum += (cnt * cntb * (((long long)1 << i)) % mo);
    sum = sum % mo;
  }
  cout << sum << endl;
}
