#include <bits/stdc++.h>
using namespace std;
const int MAX_ = 62;
int main() {
  long long ans = 0;
  long long N;
  cin >> N;
  vector<long long> A(N, 0);
  long long bit1_kazu[MAX_] = {0};
  for (int i = 0; i < (N); ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < (N); ++i) {
    long long temp_int = A[i];
    long long biti = 0;
    while (temp_int > 0) {
      if (A[i] & (1ll << biti)) {
        bit1_kazu[biti] += 1;
      }
      temp_int = temp_int >> 1;
      biti += 1;
    }
  }
  for (int i = 0; i < (MAX_); ++i) {
    long long unit = pow(2, i);
    long long kazu0 = N - bit1_kazu[i];
    ans += unit * bit1_kazu[i] * (N - bit1_kazu[i]);
  }
  long long a = pow(10, 9);
  a += 7;
  ans = ans % a;
  cout << ans << endl;
  return 0;
}
