#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long B = 61;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<bool>> bit(N, vector<bool>(B));
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < B; j++) {
      bit[i][j] = (A[i] & (1LL << j));
    }
  }
  long long ans = 0;
  long long two = 1;
  for (long long j = 0; j < B; j++) {
    long long one = 0, zero = 0;
    for (long long i = 0; i < N; i++) {
      if (bit[i][j])
        one++;
      else
        zero++;
    }
    long long res = (two * one * zero) % MOD;
    ans += res;
    ans %= MOD;
    two *= 2LL;
    two %= MOD;
  }
  cout << ans << endl;
  return 0;
}
