function main(input: string) {
  const [N, As] = input.split("\n").map((v,i) => i === 0 ? parseInt(v) : v.split(" ").map(vv => parseInt(vv)));
  let result = 0;
  const t = Math.pow(10, 9) + 7;
  for (i = 0; i < N - 1; i++) {
    for (j = i + 1; j < N; j++) {
      result += As[i] ^ As[j];
      console.log(`i:${i}, j:${j}, result:${result}`);
    }
  }
  console.log(result % t);
  console.log(result);
  console.log(t);
}

main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .trim()
);
