import java.util.*

fun rangesum(n: Int, m: Int): Long {
    return n.toLong() * (n.toLong() + 1) / 2 - m.toLong() * (m.toLong() + 1) / 2
}

fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val a = Array<Int>(n, { cin.nextInt() })
    var pluser = a[0]
    var xorer = a[0]
    var l = 0
    var r = 0
    var extending = true
    var r_checkpoint = -1
    
    var ans: Long = 0
    while (n > r) {
        if (extending) {
            if (r != n-1) {
                r += 1
                pluser += a[r]
                xorer = xorer xor a[r]
                if (pluser != xorer) {
                    extending = false
                    ans += rangesum(r - l, r_checkpoint - l)
                    r_checkpoint = r
                }
            } else {
                ans += rangesum(r - l + 1, r_checkpoint - l)
                break
            }
        } else {
            if (n == r-1) {
                break
            }
            pluser -= a[l]
            xorer = xorer xor a[l]
            l += 1
            if (pluser == xorer) {
                extending = true
            }
        }
    }
    println(ans)
}