#include #include #include #include #include #include #include int main(){ int n,types_i; scanf("%d",&n); int *types = malloc(sizeof(int) * n); for( types_i = 0; types_i < n; types_i++){ scanf("%d",&types[types_i]); } int count[n]; for( types_i = 0; types_i < n; types_i++){ count[types_i] = 0; } int max =0; int index =6; for( types_i = 0; types_i < n; types_i++){ count[types[types_i]]++; if( count[types[types_i]] == max && (index > types[types_i]) ){ max = count[types[types_i]]; index = types[types_i]; } else if( count[types[types_i]] > max){ max = count[types[types_i]]; index = types[types_i]; } } printf("%d",index); // your code goes here return 0; }