#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
void start() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  start();
  long long n, sum = 0;
  cin >> n;
  vector<long long> v(n);
  for (long long &c : v) cin >> c;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      sum += (v[i] ^ v[j]) % (1000000000 + 7);
    }
  }
  cout << sum % (1000000000 + 7) << endl;
  return 0;
}
