#include <bits/stdc++.h>
using namespace std;
unsigned long long int a[100000];
int myXOR(int x, int y) { return (x | y) & (~x | ~y); }
int main() {
  unsigned long long int sum;
  int n;
  cin >> n;
  unsigned long long int sum1 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum = (a[i] ^ a[j]) % 1000000007;
      sum1 = sum1 + sum;
      sum1 = sum1 % 1000000007;
    }
  }
  cout << sum1 << endl;
  return 0;
}
