import java.util.Scanner object Problem290 { def proc(N: Int, S: String): String = { val result = N match { case 1 => false case 2 => S(0) == S(1) case 3 => S(0) == S(1) || S(1) == S(2) case _ => true } result match { case true => "YES" case false => "NO" } } def main(args: Array[String]) { val sc = new Scanner(System.in) val N = sc.nextInt() val S = sc.next() val result = proc(N, S) println(result) } }