#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int, int> > qu2;
priority_queue<int> pq;
static const int NIL = -1;
static const int INF = 1000000007;
deque<int> deq;
long long ans = 0;
long long a[300005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= (int)(n); i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= (int)(n - 1); i++) {
    for (int j = i + 1; j <= n; j++) {
      ans += (a[i] ^ a[j]);
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
