#include <bits/stdc++.h>
using namespace std;
long long const MAX = 2147483647, REALMAX = 9223372036854775806;
const long long N = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, sum = 0;
  cin >> n;
  vector<long long> v(n);
  for (long long &i : v) cin >> i;
  for (long long i = (0); i < (n - 1); i++) {
    for (long long j = (i + 1); j < (n); j++) {
      sum += v[i] ^ v[j];
      sum %= N;
    }
  }
  cout << sum;
}
