#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll X = 1000000007;
ll re(bitset<60> u) {
  ll ans = 0;
  for (int i = 59; i >= 0; i--) {
    ans *= 2;
    ans %= X;
    ans += u.test(i);
    ans %= X;
  }
  return ans;
}
int main() {
  ll N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (ll i = 0; i < N; i++) {
    ll a;
    cin >> a;
    bitset<60> p(a);
    A.at(i) = p;
  }
  ll Ans = 0;
  for (ll i = 0; i < N - 1; i++) {
    for (ll j = i + 1; j < N; j++) {
      Ans += re(A.at(i) ^ A.at(j));
      Ans %= X;
    }
  }
  cout << Ans << endl;
}
