#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<long long> A;
  for (int i = 0; i < n; i++) {
    long long tmp_a;
    cin >> tmp_a;
    A.push_back(tmp_a);
  }
  long long ans = 0;
  for (int i = 0; i <= 61; i++) {
    long long counter_0 = 0;
    long long counter_1 = 0;
    for (int j = 0; j < n; j++) {
      if ((A[j] >> i) & 1) {
        counter_1 += 1;
      } else {
        counter_0 += 1;
      }
    }
    long long seki = counter_0 * counter_1;
    ans += (seki * 1 << i) % 1000000007LL;
    ans %= 1000000007LL;
  }
  cout << ans;
  return 0;
}
