{
  const main = (input: string) => {
    const r = reader(input)
    const N = r.n()
    const a = r.ns()

    const _mod = 1000000007

    let res = 0

    for (let i = 0; i < N - 1; i++) {
      for (let j = i + 1; j < N; j++) {
        // console.log(a[i], a[j])
        // console.log(a[i] ^ a[j])
        // console.log(res)
        res = (res + (a[i] ^ a[j])) % _mod
      }
    }
    console.log(res)
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')

  main(getInput())
}
