#include <bits/stdc++.h>
using namespace std;
const vector<vector<int>> DIR{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
const int MOD = 1000000007;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
template <class T>
int dp2csv(const vector<vector<T>>& dp, const string fname);
int range_check(int val, int min, int max) {
  if (val < min) {
    return min;
  }
  if (val > max) {
    return max;
  }
  return val;
}
template <class T, class T1>
bool array_find(const T& array, const T1& dst) {
  auto result = find(array.first(), array.end(), dst);
  if (result == array.end()) {
    return false;
  } else {
    return true;
  }
}
int main() {
  unsigned int n;
  cin >> n;
  vector<long long> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int k = i + 1; k < n; ++k) {
      ans += (vec[i] ^ vec[k]) % MOD;
      if (ans > MOD) {
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
template <class T>
int dp2csv(const vector<vector<T>>& dp, const string fname) {
  ofstream ofs(fname);
  if (ofs.fail()) {
    cerr << "cannot open file. :" + fname << endl;
    return -1;
  }
  for (auto dp_row : dp) {
    for (auto dp_cell : dp_row) {
      ofs << dp_cell << ",";
    }
    ofs << endl;
  }
  ofs.close();
  return 0;
}
