#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18 + 1;
const ll DIV = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (size_t i = 0; i < N; i++) {
    ll a;
    cin >> a;
    A[i] = bitset<60>(a);
  }
  ll total = 0;
  for (size_t b = 0; b < 60; b++) {
    ll zero_count = 0;
    ll one_count = 0;
    for (size_t i = 0; i < N; i++) {
      if (A[i][b])
        one_count++;
      else
        zero_count++;
    }
    cerr << zero_count << ":" << one_count << ":" << zero_count * one_count
         << endl;
    total += (one_count * zero_count) * ((ll)pow(2, int(b)) % DIV) % DIV;
  }
  cout << total % DIV << endl;
  return 0;
}
