#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  const long long mod = pow(10, 9) + 7;
  map<int, long long> A;
  long long sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int bit = 0; bit <= 60; bit++) {
    long long ones = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] >> bit) & 1) ones++;
    }
    sum += ((1LL << bit) % mod) * (ones % mod) * ((N - ones) % mod) % mod;
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
