#include <bits/stdc++.h>
using namespace std;
vector<long> read();
long think(const vector<long> &);
void write(long);
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  auto input = read();
  auto output = think(input);
  write(output);
  return 0;
}
vector<long> read() {
  int n;
  long buf;
  scanf("%d", &n);
  auto input = vector<long>(n);
  for (int i = 0; i < n; i++) {
    scanf("%ld", &buf);
    input.at(i) = buf;
  }
  return input;
}
long think(const vector<long> &input) {
  long mode = 1000000000 + 7;
  long result = 0;
  for (int i = 0; i < input.size(); i++) {
    for (int j = i + 1; j < input.size(); j++) {
      result += input.at(i) ^ input.at(j);
      result %= mode;
    }
  }
  return result;
}
void write(long result) { printf("%ld\n", result); }
