#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
void solve(long long N, std::vector<long long> A) {
  long long maxA = *max_element(A.begin(), A.end());
  long long k = floor(log2(maxA)) + 1;
  long long res = 0, n_ones = 0;
  for (size_t j = 0; j < k; j++) {
    n_ones = 0;
    for (size_t i = 0; i < N; i++) {
      n_ones += (A[i] >> j) & (1);
    }
    res += ((n_ones * (N - n_ones)) << j);
  }
  cout << (res % 1000000007) << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
