#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> A.at(i);
  }
  const int mod = 1000000007;
  long long ans = 0;
  vector<long long int> bit_count_0(62, 0);
  vector<long long int> bit_count_1(62, 0);
  vector<long long int> pow_list(62, 0);
  for (int i = 0; i < 62; i++) {
    pow_list.at(i) = pow(2, i);
  }
  for (int i = 0; i <= 61; i++) {
    for (int j = 1; j <= N; j++) {
      if ((pow_list[i] & A.at(j)) == 0) {
        bit_count_0.at(i) += 1;
      } else {
        bit_count_1.at(i) += 1;
      }
    }
  }
  for (int i = 0; i <= 61; i++) {
    ans =
        (ans + (bit_count_0.at(i) * bit_count_1.at(i) * pow_list.at(i)) % mod) %
        mod;
  }
  cout << ans << endl;
  return 0;
}
