#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int INF = 1 << 30;
long long INFL = 1LL << 60;
long long MODP = 998244353;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (N); i++) cin >> A[i];
  long long ans = 0;
  for (long long i = 0; i < (60); i++) {
    long long a = 0, b = 0;
    for (long long j = 0; j < (N); j++) {
      if (A[j] % 2 == 0)
        a++;
      else
        b++;
      A[j] = A[j] >> 1;
    }
    ans = (ans % MOD + (a * b * (1 << i)) % MOD) % MOD;
  }
  cout << ans % MOD << endl;
}
