import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); int countRequired = 0; String l = reader.readLine(); for (int i = 1; i < N; i++) { String s = reader.readLine(); if (l.equals(s)) { countRequired += 1; } else { if (countRequired > 0) { countRequired -= 1; } l = s; } System.out.println(countRequired + " , current " + l); } if(countRequired>0){ System.out.println("NO"); } else{ System.out.println("YES"); } } }