const main = (input) => {
    input = input.trim()
	const lines = input.split('\n')
    const n = Number(lines[0])
    const as = lines[1].split(' ').map(n => Number(n))
  let result = 0
  const seed = 1000000007
  for (let i = 1; i <= n-1; i++) {
    for (let j = i+1; j <= n; j++) {
      const xor = as[i-1] ^ as[j-1]
      const add = xor%seed
      result += add
      result %= seed
    }
  }
  console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
