#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<long long> v;
  long long n, temp;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> temp;
    v.push_back(temp);
  }
  long long sum = 0;
  for (long long i = 0; i < v.size() - 1; i++)
    for (long long j = i + 1; j < v.size(); j++) {
      sum += (v[i] ^ v[j]) % mod;
    }
  cout << sum % mod;
  return 0;
}
