#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int num = 60;
  vector<long long> dig(num, 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < num; j++) {
      long long x = (A[i] >> j) % 2;
      dig[j] += x;
    }
  }
  long long ans = 0;
  long long tmp = 1;
  for (long long i = 0; i < num; i++) {
    ans = (ans + dig[i] * (N - dig[i]) * tmp) % MOD;
    tmp *= 2;
    tmp %= MOD;
  }
  cout << ans << endl;
}
