package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return &Scanner{sc}
}

func (sc *Scanner) NextInt() int {
	sc.sc.Scan()
	i, err := strconv.Atoi(sc.sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

const MOD = 1e9 + 7

func main() {
	sc := NewScanner()
	n := sc.NextInt()
	a := make([]uint64, n)
	for i := 0; i < n; i++ {
		a[i] = uint64(sc.NextInt())
	}
	var sum uint64
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			sum = (sum + (a[i]^a[j])%MOD) % MOD
		}
	}
	fmt.Println(sum % MOD)
}
