#include <bits/stdc++.h>
using namespace std;
int N;
vector<long long> A(300001);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      ans += (A.at(i) ^ A.at(j)) % 1000000007;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
}
