#include <bits/stdc++.h>
using namespace std;
long int change(long int n, long int m) { return n ^ m; }
int main() {
  int n;
  const int N = pow(10, 9) + 7;
  cin >> n;
  vector<long int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long int ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += change(a[i], a[j]);
      ans %= N;
    }
  }
  cout << ans << endl;
  return 0;
}
