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