#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
int main(void) {
  int N;
  cin >> N;
  vector<long long> A(300010);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long res = 0;
  for (int j = 0; j < 60; j++) {
    long long zero = 0, one = 0;
    const long long X = (1LL << j);
    for (int i = 0; i < N; i++) {
      if (A[i] & X)
        one++;
      else
        zero++;
    }
    res += ((zero * one) << j) % MOD;
    res %= MOD;
  }
  cout << res << endl;
  return 0;
}
