#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N;
  int64_t mod = 1000000007;
  cin >> N;
  vector<int64_t> A(N);
  vector<int64_t> count(61, 0);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < 61; i++) {
    for (int j = 0; j < N; j++) {
      if (A[j] & (1 << i)) count[i]++;
    }
  }
  int64_t sum = 0;
  for (int i = 0; i < 61; i++) {
    int64_t x = std::pow(2, i);
    x %= mod;
    sum += x * (N - count[i]) % mod * count[i] % mod;
    sum %= mod;
  }
  cout << sum << endl;
}
