#include <bits/stdc++.h>
using namespace std;
template <typename T>
void showvector(vector<T> v) {
  for (T x : v) cout << x << " ";
  cout << "\n";
}
template <typename T>
void showvector1(vector<T> v) {
  long long int n = v.size();
  for (long long int i = 1; i <= n - 1; i++) cout << v[i] << "\n";
}
template <typename T>
void showset(set<T> s) {
  for (T x : s) cout << x << " ";
  cout << "\n";
}
template <class T>
void showvectorpair(vector<T> v) {
  for (auto it = v.begin(); it != v.end(); it++)
    cout << it->first << " " << it->second << "\n";
  cout << "\n";
}
template <typename T, typename P>
void showmap(map<T, P> m) {
  for (auto it = m.begin(); it != m.end(); it++)
    cout << it->first << " " << it->second << "\n";
  cout << "\n";
}
template <typename T>
bool comp(T a, T b) {
  return (a > b);
}
template <class T>
bool comppair(T a, T b) {
  if (a.first == b.first) return (a.second > b.second);
  return (a.first > b.first);
}
bool sameparity(long long int a, long long int b) { return (a % 2 == b % 2); }
bool difparity(long long int a, long long int b) { return !(a % 2 == b % 2); }
bool isprime(long long int x) {
  if (x <= 1) return false;
  for (long long int i = 2; i <= sqrt(x); i++) {
    if (x % i == 0) return false;
  }
  return true;
}
bool iseven(long long int x) { return !(x % 2); }
bool isodd(long long int x) { return (x % 2); }
void vfun() {
  long long int n, k;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
}
long long int C(long long int n, long long int r) {
  if (n < r) return 0;
  r = min(r, n - r);
  long long int res = 1;
  for (long long int i = 0; i < r; i++) {
    res *= (n - i);
  }
  for (long long int i = 0; i < r; i++) {
    res /= (i + 1);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int test = 1;
  while (test--) {
    long long int n;
    cin >> n;
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) cin >> v[i];
    long long int res = 0;
    for (long long int i = 0; i < n; i++) {
      for (long long int j = i + 1; j < n; j++) {
        res += (v[i] ^ v[j]);
        res %= 1000000007;
      }
    }
    cout << res;
  }
}
