#!/usr/bin/perl use strict; use warnings; my $n = <>; my $l = <>; chomp $l; my @array = split / /, $l; my @count; for(my $i = 0; $i < $n + 1; $i++) { $count[$i] = 0; } for(my $i = 0; $i < $n; $i++) { $count[$array[$i]]++; } my $keep = 0; my $j = 0; for(my $i = 0; $i < $n + 1; $i++) { if($keep <= $count[$i]) { $j = $i; $keep = $count[$i]; } } print "$j\n"; exit;