#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 i = 0; i < N - 1; i++) {
    for (size_t j = i + 1; j < N; j++) {
      bitset<60> xor_i_j = A[i] ^ A[j];
      total += xor_i_j.to_ullong() % DIV;
    }
  }
  cout << total % DIV << endl;
  return 0;
}
