#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll xxxor(ll a, ll b) {
  ll sumxor = 0;
  int countxor = 0;
  while (a > 0 || b > 0) {
    if (a % 2 != b % 2) sumxor += pow(2, countxor);
    countxor++;
    a /= 2;
    b /= 2;
  }
  return sumxor;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  ll sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += xxxor(a.at(i), a.at(j));
    }
  }
  cout << sum % 1000000007 << endl;
}
