#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a;
  long long int ans = 0;
  for (int i = (0); i < (n); ++i) {
    long long int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += a[i] ^ a[j];
    }
  }
  cout << ans % (1000000000 + 7) << endl;
}
