import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); boolean can; if (n == 1) { can = false; } else if (n == 2) { can = (arr[0] == arr[1]); } else if (n == 3) { can = (arr[0] == arr[1] || arr[1] == arr[2]); } else { can = true; } if (can) { System.out.println("YES"); } else { System.out.println("NO"); } } }