#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<long long>>;
int main() {
  const long long mod = 1e9 + 7;
  int N;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < N; i++) cin >> A[i];
  long long B[62] = {0};
  for (long long i = 0; i < 62; i++) {
    int zero = 0;
    int one = 0;
    for (long long j = 0; j < N; j++) {
      if (((A[j] >> i) & 1LL) == 1LL)
        one++;
      else
        zero++;
    }
    B[i] = (one * zero) % mod;
  }
  long long ans = 0LL;
  for (long long i = 0; i < 62; i++) {
    ans += (B[i] * ((1LL << i) % mod)) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
