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