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