#include <bits/stdc++.h>
const unsigned int M = 1000000007;
using namespace std;
int main() {
  int i, j, n;
  long long int x, ans = 0;
  cin >> n;
  long long int arr[n];
  for (i = 0; i < n; i++) {
    cin >> x;
    arr[i] = x;
  }
  for (j = 0; j < n - 1; j++) {
    for (int k = j + 1; k < n; k++) {
      ans += arr[j] ^ arr[k];
    }
  }
  cout << ans % M << endl;
  return 0;
}
