#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 100010;
void solve() {
  long long int ans = 0;
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = (ans + (a[i] ^ a[j]) % MOD) % MOD;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long int t = 1;
  for (long int tt = 1; tt <= t; tt++) {
    solve();
  }
  return 0;
}
