#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long *arr = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      sum = (sum % 1000000007 + (arr[i] ^ arr[j]) % 1000000007) % 1000000007;
    }
  }
  cout << sum;
  return 0;
}
