#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> c;
  int n;
  long long temp;
  long long ans = 0;
  cin >> n;
  while (n--) {
    cin >> temp;
    c.push_back(temp);
  }
  for (int i = 0; i < c.size() - 1; i++) {
    for (int j = i + 1; j < c.size(); j++) {
      ans += (c[i] ^ c[j]);
      ans %= (1000000007);
    }
  }
  cout << ans % (1000000007) << endl;
  return 0;
}
