const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const lines = input.split('\n')
    const N = lines[0] - 0
    const A = lines[1].split(' ').map(Number)

    const d = [A[0]]
    const xor = [A[0]]

    let count = 0
    for (let i = 1; i < N; i++) {
        d[i] = d[i - 1] + A[i]
        xor[i] = xor[i - 1] ^ A[i]
        if (d[i] === xor[i]) {
            count++
        }
    }

    const prog = (n, m, d = 1) => {
        if (!m) return 0
        let sum = n
        let add = n
        for (let i = 1; i < m; i++) {
            add += d
            sum += add
        }
        return sum
    }

    console.log(prog(N, count + 1, -1))

})(input)
