import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int N = scan.nextInt(); HashMap map = new HashMap<>(); for(int i=0; i array = new ArrayList<>(); for(Entry entry : map.entrySet()) { array.add((Integer)entry.getValue()); } while(true) { if(array.size() == 1) { System.out.println("No"); break; } int max = 0; int index = 0; int zeroCount = 0; for(int i=0; i sum) { array.set(i, 0); int t = array.get(index); array.set(index, t-v); } else { array.set(i, sum-rem); array.set(index, 0); break; } } } } } }