#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long long mod = pow(10, 9) + 7;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long count = 0;
  for (int i = 0; i < 62; i++) {
    long long zeros = 0;
    long long ones = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & (1LL << i) == 0) {
        zeros++;
      } else {
        ones++;
      }
    }
    long long c = (((zeros * ones) % mod) * ((1LL << i) % mod)) % mod;
    count += c % mod;
    count %= mod;
  }
  cout << count << endl;
}
