#include <bits/stdc++.h>
using namespace std;
long long n, a[300030], ans = 0, p = 1e9 + 7;
int main() {
  scanf("%d", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += a[i] ^ a[j];
      ans %= p;
    }
  }
  cout << ans;
  return 0;
}
