def main():
    N = int(input())
    an = list(map(int, input().split()))

    ans = True

    for i, a in enumerate(an):
        if a != an[i - 1] ^ an[(i + 1) % N]:
            ans = False
            break

    print("Yes" if ans else "No")


if __name__ == '__main__':
    main()
