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