#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long MAX = 9000000000000000000;
const long long MIN = -9000000000000000000;
const long double DMAX = 4500;
const long double DMIN = -4500;
const long long MOD = 1000000007;
template <typename T>
void fin(T a) {
  cout << a << endl;
  exit(0);
}
long long GetDigit(long long num) { return log10(num) + 1; }
long long sigma(long long n, long long m) {
  return ((n + m) * (m - n + 1) * 0.5);
}
void Main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans += (a[i] ^ a[j]);
      ans %= MOD;
    }
  }
  fin(ans);
}
int main() {
  cout << fixed << setprecision(20);
  Main();
  return 0;
}
