#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < (ll)(N); i++) cin >> A.at(i);
  ll res = 0;
  ll two = 1;
  for (int i = 0; i < 60; i++) {
    int zero = 0, one = 0;
    for (int n = 0; n < N; n++) {
      if (A.at(n) & (1LL << i))
        one++;
      else
        zero++;
    }
    ll add = (zero * one) % 1000000007 * two % 1000000007;
    res = (res + add) % 1000000007;
    two = (two * 2) % 1000000007;
  }
  cout << res << endl;
}
