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