#include <bits/stdc++.h>
using namespace std;
int main(void) {
  const long long Odd = 1000000007;
  int N = 0;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long result = 0;
  int bit = 0;
  for (int d = 0; d < 60; d++) {
    for (int i = 0; i < N; i++) {
      if (a[i] & (1ll << d)) {
        bit++;
      }
    }
    result += (long long)(bit * (N - bit)) * (1ll << d);
    bit = 0;
  }
  cout << result % Odd << endl;
  return 0;
}
