#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<string> B(N);
  for (long long i = 0; i < N; i++) {
    B[i] =
        bitset<60>(A[i]).to_string<char, char_traits<char>, allocator<char> >();
  }
  long long ans = 0;
  long long number_zero = 0;
  long long number_one = 0;
  for (long long i = 0; i < 60; i++) {
    for (long long j = 0; j < N; j++) {
      if (B[j][59 - i] == '0')
        number_zero++;
      else if (B[j][59 - i] == '1')
        number_one++;
    }
    ans += ((number_zero * number_one) * (long long)pow(2, i)) %
           ((long long)pow(10, 9) + 7);
    ans %= (long long)(pow(10, 9) + 7);
    number_zero = 0;
    number_one = 0;
  }
  cout << ans << endl;
  return 0;
}
