#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> as;
  for (auto i = 0; i < n; i++) {
    long long a;
    cin >> a;
    as.push_back(a);
  }
  long long res = 0;
  for (auto i = 0; i < n; i++) {
    for (auto j = i + 1; j < n; j++) {
      res = (res + (as[i] ^ as[j])) % 1000000007;
    }
  }
  cout << res << endl;
}
