#include <bits/stdc++.h>
using namespace std;
int count_one(int x) {
  int cnt = 0;
  while (x) {
    x &= (x - 1);
    cnt++;
  }
  return cnt;
}
int one(string s) {
  int cnt = 0;
  for (auto i : s) {
    if (s[i] == 1) cnt++;
  }
  return cnt;
};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  int sum = 0, x;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      sum = ((v[i] ^ v[j]) + sum) % 1000000007;
    }
  }
  cout << sum << endl;
}
