#include <bits/stdc++.h>
using namespace std;
typedef struct datum_name {
  int x;
  int y;
  int whosay;
  bool operator==(const datum_name &data) const {
    return (x == data.x && y == data.y);
  }
} datum;
bool cmp_who(const datum &left, const datum &right) {
  return left.whosay < right.whosay;
}
int main() {
  int N;
  cin >> N;
  vector<int64_t> array;
  for (int i = 0; i < N; i++) {
    int64_t tmp;
    cin >> tmp;
    array.push_back(tmp);
  }
  int64_t sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      int64_t tmp3 = (array[i] xor array[j]);
      sum = (sum + tmp3) % (1000000000 + 7);
    }
  }
  cout << sum << endl;
  return 0;
}
