#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (long long)(N); ++i) cin >> A[i];
  vector<long long> two_pow(61);
  two_pow[0] = 1;
  for (long long i = 1; i < (long long)(61); ++i)
    two_pow[i] = two_pow[i - 1] * 2;
  vector<vector<long long>> digits(N, vector<long long>(61));
  for (long long i = 0; i < (long long)(N); ++i) {
    long long a = A[i];
    for (long long j = 61 - 1; j >= 0; --j) {
      digits[i][j] = a / two_pow[j];
      a %= two_pow[j];
    }
  }
  vector<long long> cnt(61, 0);
  for (long long i = 0; i < (long long)(N); ++i)
    for (long long j = 0; j < (long long)(61); ++j) cnt[j] += digits[i][j];
  vector<long long> sum(61);
  for (long long i = 0; i < (long long)(61); ++i)
    sum[i] = cnt[i] * (N - cnt[i]);
  long long ans = 0;
  for (long long i = 0; i < (long long)(61); ++i) {
    ans += two_pow[i] % mod * sum[i] % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
