#include <bits/stdc++.h>
int main() {
  int n, i, j;
  scanf("%d", &n);
  long int sum = 0;
  long int arr[n];
  for (i = 0; i < n; i++) {
    scanf("%ld", &arr[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      sum = (sum % 1000000007 + (arr[i] ^ arr[j]) % 1000000007) % 1000000007;
    }
  }
  printf("%ld", sum);
}
