import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int count = 0; int[] types = new int[n]; HashSet hs = new HashSet(); for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } // ArrayList arrayList = new ArrayList(Arrays.asList(types)); // System.out.println("Size of al after deletions: " +arrayList ); for (int i = 0; i < types.length; i++) { for (int j = i + 1; j < types.length; j++) { if (types[i] == types[j]) // hs.add(types[i]); count++; } } System.out.println(types[1]); } // your code goes here }