<?php
$ans = 0;
$memo = [];
fscanf(STDIN, '%d', $cnt);
$nums = array_map('intval', explode(' ', trim(fgets(STDIN))));
$lim = $cnt;
for ($i=0; $i < $lim; $i++) { 
    for ($j=0; $j < $lim; $j++) { 
        $key = min($i, $j).'-'.max($i, $j);
        if (in_array($key, $memo)) {
            continue;
        }
        $tmp = $nums[$i] ^ $nums[$j];
        $ans += $tmp;
        $memo[] = $key;
    }
}
echo $ans % (10**9+7)."\n";