package me.yukicoder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; /** * No. 79 * http://yukicoder.me:8081/problems/202 * Star 1 */ public class YukiCoder79 { public static void run() { Scanner sc = new Scanner(System.in); int[] levels = new int[7]; int n = sc.nextInt(); for (int i = 0; i < n; i++) { int level = sc.nextInt(); levels[level]++; } int ans = 0; for (int i = 1; i < 7; i++) { if (levels[i] >= levels[ans]) { ans = i; } } System.out.println(ans); } private static TestCase getTest1() { return new TestCase("2", "5", "2 1 2 3 2"); } private static TestCase getTest2() { return new TestCase("3", "5", "1 2 3 3 1"); } private static TestCase getTest3() { return new TestCase("6", "10", "5 3 5 6 3 6 2 3 5 6"); } private static TestCase getTest4() { return new TestCase("", ""); } private static TestCase getTest5() { return new TestCase("", ""); } // return new TestCase("", ""); // return new TestCase("", ""); public static void main(String[] args) { perform(); } private static boolean LOCAL = System.getenv().keySet().stream().anyMatch(key -> key.startsWith("JAVA_MAIN_CLASS")); private static void perform() { if (LOCAL) { List tests = getTests(); boolean passed = true; int index = 1; for (TestCase testCase : getTests()) { String input = Arrays.stream(testCase.inputs).collect(joining(System.lineSeparator())); InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); PrintStream sout = System.out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); System.setOut(ps); try { run(); } finally { System.setOut(sout); } System.out.flush(); String actual = baos.toString().trim(); String expect = testCase.expect; boolean match = expect != null && expect.equals(actual); System.out.println("------------------------ " + index++ + "/" + tests.size() + " " + (match ? "PASS" : "FAIL")); System.out.println("INPUT: " + input); System.out.println("RESULT: " + match); System.out.println("EXPECTED: " + expect + ":"); System.out.println("ACTUAL: " + actual + ":"); if (!match) passed = false; } System.out.println("\n==== SUMMARY ==== "); System.out.println(passed ? "PASS" : "FAIL"); } else { run(); } } public static List getTests() { List testCases = new ArrayList<>(); testCases.add(getTest1()); testCases.add(getTest2()); testCases.add(getTest3()); testCases.add(getTest4()); testCases.add(getTest5()); return testCases.stream().filter(t -> !t.ignore()).collect(toList()); } private static class TestCase { String expect; String[] inputs; public TestCase(String expect, String... inputs) { this.expect = expect; this.inputs = inputs; } public boolean ignore() { return "".equals(expect) && inputs.length == 1 && "".equals(inputs[0]); } } }