<?php

$N = trim(fgets(STDIN));
$A = explode(' ', trim(fgets(STDIN)));

$res = 0;
foreach ($A as $outerKey => $item) {
    foreach ($A as $innerKey => $innerItem) {
        if ($outerKey <= $innerKey && $outerKey !== $innerKey) {
            $kotae = (int) $item ^ (int) $innerItem;
            $res += $kotae;
        }
    }
}
echo ($res % (pow(10, 9) + 7)) . PHP_EOL;
