#!/bin/bash

while true;
do
        read line1
        read line2

        if [ -z "$line1" ]; then
                break
        fi

        N=`echo $line2 | awk '{print NF}'`
        xorSum=0;

        for i in `seq 1 $N`;
        do
                iplus1=`echo $(( $i + 1 ))`
                for j in `seq $iplus1 $N`;
                do
                        vali=`echo $line2 | cut -d " " -f $i`
                        valj=`echo $line2 | cut -d " " -f $j`

#                       printf "[i]%d, [j]%d, [vali]%d, [valj]%d\n" $i $j $vali $valj

                        xorNum=$(( $vali ^ $valj ))
                        xorSum=$(( $xorSum + $xorNum ))
                done

        done

        echo $(( $xorSum % $(( 10**9 + 7 )) ))

done