#!/bin/bash

#lessThanG(){
#       res=$1
#       while true;
#       do
#               if [ $1 -lt 1000000000 ]; then
#                       break
#               fi
#               res=$(( $res- 10**9 ))
#       done
#
#       echo $res;
#
#}

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 ))
#                       xorRes=`lessThanG $xorNum`
                        xorSum=$(( $xorSum + $xorNum ))
                done

        done

        xorSum=`echo $xorSum | rev | cut -c 1-9 | rev`

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

done