#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chMax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chMin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  vector<long long> A;
  map<long long, int> Amap;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long temp;
    cin >> temp;
    if (find(begin(A), end(A), temp) != end(A)) {
      Amap[temp]++;
    }
    A.push_back(temp);
  }
  sort(begin(A), end(A));
  A.erase(unique(begin(A), end(A)), end(A));
  int len = A.size();
  long long ans = 0;
  for (long long i = 0; i < len - 1; i++) {
    for (long long ii = i + 1; ii < len; ii++) {
      long long temp1 = A[i] ^ A[ii];
      if (Amap.find(A[i]) != Amap.end()) {
        temp1 *= (Amap[A[i]] + 1);
      }
      if (Amap.find(A[ii]) != Amap.end()) {
        temp1 *= (Amap[A[ii]] + 1);
      }
      ans += temp1 % 1000000007;
    }
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
