import * as fs from "fs" type Input = (args: string) => void const product = (pool: number[], repeat: number) => { let result: number[][] = new Array(new Array()) for (let i = 0; i < repeat; i++) { let tmp: number[][] = new Array() result.forEach(x => { pool.forEach(y => tmp.push(x.concat(y))) }) result = tmp } return result }; const main: Input = args => { const input = args.trim().split("\n"); const N = +input.shift() const E = input.shift().split(" ").map(x => +x) let ans = false product([0, 1, 2], N).forEach(x => { let team = Array(3).fill(0); E.forEach((e, i) => team[x[i]] += e) if (team.every(el => el === team[0])) ans = true }) console.log(ans ? "Yes" : "No") } main(fs.readFileSync('/dev/stdin', 'utf8'))