#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = (0); i < (N); ++i) cin >> A[i];
  long long ans = 0;
  for (int i = 59; i >= 0; --i) {
    int count = 0;
    for (long long j = (0); j < (N); ++j)
      if (A[j] & (1LL << i)) count++;
    ans *= 2;
    ans %= mod;
    ans += count * (N - count) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
