#include <bits/stdc++.h>
using namespace std;
int main() {
  using ull = unsigned long long;
  constexpr const ull m = 1000000000 + 7;
  ull n;
  cin >> n;
  vector<ull> a(n, 0);
  for (ull i = 0; i < n; ++i) cin >> a[i];
  ull b = 0;
  for (ull i = 0; i + 1 < n; ++i) {
    ull c = 0;
    for (ull j = i + 1; j < n; ++j) {
      c = (c % m + (a[i] ^ a[j]) % m) % m;
    }
    b = (b % m + c % m) % m;
  }
  cout << b << endl;
  return 0;
}
