public static void SecondndLargestfromarray()
{
var scan = new Scanner(System.in);
var n = scan.nextInt();
long l=Long.MIN_VALUE;
long p=Long.MIN_VALUE;
for (int i = 0; i < n; i++) {
var sc = scan.nextLong();
if(sc>l)
{
p=l;
l=sc;
}
else if(sc>p ) p = sc;
}
System.out.println(p);
}