#include <bits/stdc++.h>
using namespace std;
const int64_t M = pow(10, 9) + 7;
int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  int64_t sum = 0;
  for (int n = 0; n < 60; ++n) {
    int64_t sub_sum1 = 0;
    for (int i = 0; i < N; ++i) {
      bitset<60> s(A.at(i));
      if (s.test(n)) {
        ++sub_sum1;
      }
    }
    sum = (sum + int64_t(pow(2, n)) * sub_sum1 * (N - sub_sum1)) % M;
  }
  cout << sum << endl;
}
