#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<int> count(60, 0);
  ll res = 1;
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < N; j++) {
      count.at(i) += A.at(j) % 2;
      A.at(j) /= 2;
    }
    ans += (count.at(i) * (N - count.at(i)) % 1000000007) * res % 1000000007;
    ans %= 1000000007;
    res *= 2;
    res %= 1000000007;
  }
  cout << ans << endl;
}
