#include <bits/stdc++.h>
const long long int mod = 1000000007;
int main() {
  long long int N;
  std::cin >> N;
  std::vector<long long int> A(N);
  for (long long int i = 0; i < N; ++i) std::cin >> A[i];
  std::vector<long long int> cnt(60);
  for (long long int i = 0; i < 60; ++i) {
    for (long long int j = 0; j < N; ++j)
      cnt[i] += ((A[j] & (1LL << i)) ? 1 : 0);
  }
  long long int ans = 0;
  for (long long int i = 0; i < 60; ++i) {
    long long int a = cnt[i], b = N - cnt[i];
    (ans += (a * b * (1LL << i)) % mod) %= mod;
  }
  std::cout << ans << std::endl;
}
