#include <bits/stdc++.h>
using namespace std;
long long maxu = INT_MAX;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, ans = 0;
  cin >> n;
  vector<long long int> a(n + 1);
  for (long int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (long int i = 1; i <= n - 1; ++i) {
    for (long int j = i + 1; j <= n; ++j) {
      ans += (a[i] ^ a[j]) % 1000000007;
    }
  }
  cout << ans % 1000000007;
  return 0;
}
