#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
using pll = pair<ll, ll>;
using ii = pair<int, int>;
using iii = pair<pair<int, int>, int>;
using viii = vector<iii>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using ui = unsigned int;
int main() {
  ofstream out("output.txt");
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  ll res = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      res += (((a[i]) ^ (a[j])));
    }
  }
  cout << res % 1000000007 << '\n';
  return 0;
}
