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