#include <bits/stdc++.h>
using namespace std;
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(60, 1);
  for (long long i = 1; i < (long long)(60); ++i)
    two_pow[i] = two_pow[i - 1] * 2;
  long long ans = 0;
  for (long long i = 0; i < (long long)(60); ++i) {
    long long cnt = 0;
    for (long long j = 0; j < (long long)(N); ++j) {
      if (A[j] & two_pow[i]) ++cnt;
    }
    cnt *= N - cnt;
    ans += two_pow[i] % 1000000007 * cnt % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
