#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long bit = (1LL << i);
    int zero_count = 0, one_count = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & bit) {
        one_count++;
      } else {
        zero_count++;
      }
    }
    ans += (bit % mod) * ((zero_count * one_count) % mod) % mod;
  }
  cout << (ans % mod) << endl;
}
