#!/usr/bin/perl # yukicoder My Practice # author: Leonardone @ NEETSDKASU my $n = $*IN.get; my @a = $*IN.get.words; my $mx = 0; my $ans = 0; for @a { my $v = $_.Int; if $v > $mx { $mx = $v; } elsif $ans < $v && $v < $mx { $ans = $v; } } say $ans;