#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  long long bit = 1;
  for (int b = 0; b < (61); ++b) {
    long long count = 0;
    for (int i = 0; i < (N); ++i) {
      if ((A[i] & bit) != 0) ++count;
    }
    long long tmp = (bit * count) % MOD;
    tmp = (tmp * (N - count)) % MOD;
    ans = (ans + tmp) % MOD;
    bit = bit << 1;
  }
  cout << ans << endl;
  return 0;
}
