import java.util.Scanner
import java.util.ArrayList

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    var flag : Boolean = true
    var arraylist = ArrayList<Int>()
    for(i in 0 until N) {
        arraylist.add(sc.nextInt())
    }
    var A = -1
    var B = -1
    var C = -1
    var Acounter = 0
    var Bcounter = 0
    var Ccounter = 0
    for(i in 0 until N){
        val a = arraylist.elementAt(i)
        if(a == A){
            Acounter++
        }else if(a == B){
            Bcounter++
        }else if(a == C){
            Ccounter++
        }else if(A == -1){
            A = a
            Acounter++
        }else if(B == -1){
            B = a
            Bcounter++
        }else if(C == -1){
            C = a
            Ccounter++
        }else{
            flag = false
            break
        }
    }

    if(flag == false){
       println("No")
    }else{
        if(C != -1){
            if(Acounter == Bcounter && Bcounter == Ccounter){
               if(checkxor(A, B, C)){
                   println("Yes")
               }else{
                   println("No")
               }
            }else{
                println("No")
            }
        }else if(B != -1){
            if(Acounter == 2 * Bcounter){
               if(checkxor(A, A, B)){
                   println("Yes")
               }else{
                   println("No")
               }
            }else if(Bcounter == 2 * Acounter){
                if(checkxor(A, B, B)){
                    println("Yes")
                }else{
                    println("No")
                }
            }else{
                println("No")
            }
        }else{
            if(A == 0){
                println("Yes")
            }else{
                println("No")
            }
        }
    }
}

fun checkxor(i: Int, j: Int, k: Int) : Boolean{
    var i_bitlist = ArrayList<Char>()
    var j_bitlist = ArrayList<Char>()
    var k_bitlist = ArrayList<Char>()
    val zero : Char = '0'
    val one : Char = '1'
    var i_clone = i
    var j_clone = j
    var k_clone = k
    while(i_clone != 0){
        if(i_clone % 2 == 0){
            i_bitlist.add(zero)
        }else{
            i_bitlist.add(one)
            i_clone--
        }
        i_clone /= 2
    }
    while(j_clone != 0){
        if(j_clone % 2 == 0){
            j_bitlist.add(zero)
        }else{
            j_bitlist.add(one)
            j_clone--
        }
        j_clone /= 2
    }
    while(k_clone != 0){
        if(k_clone % 2 == 0){
            k_bitlist.add(zero)
        }else{
            k_bitlist.add(one)
            k_clone--
        }
        k_clone /= 2
    }
    var max_bitLength = i_bitlist.size
    if(j_bitlist.size > max_bitLength){
        max_bitLength = j_bitlist.size
    }
    if(k_bitlist.size > max_bitLength){
        max_bitLength = k_bitlist.size
    }
    val iListSize = i_bitlist.size
    for(m in iListSize-1 until max_bitLength-1){
       i_bitlist.add(zero)
    }
    val jListSize = j_bitlist.size
    for(m in jListSize-1 until max_bitLength-1){
        j_bitlist.add(zero)
    }
    val kListSize = k_bitlist.size
    for(m in kListSize until max_bitLength){
        k_bitlist.add(zero)
    }
    var isXor = true
    for(m in 0 until max_bitLength){
        if(i_bitlist.elementAt(m) == j_bitlist.elementAt(m)){
            if(k_bitlist.elementAt(m) != zero){
                isXor = false
                break
            }
        }else{
            if(k_bitlist.elementAt(m) != one){
               isXor = false
                break
            }
        }
    }
    return isXor
}