import java.util.*; import java.io.*; import java.math.*; public class No290 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int mae = 2; String s = sc.next(); for(int i = 0; i < n; i++) { int t = s.charAt(i); if(mae == t) { System.out.println("YES"); return; } mae = t; } System.out.println("NO"); } }