process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function main() { var n = parseInt(readLine()); types = readLine().split(' '); types = types.map(Number); // your code goes here var typeCounts = [0, 0, 0, 0, 0]; for (var i = 0; i < types.length; i++) { if (types[i] === 1) { typeCounts[0] = typeCounts[0] + 1; } else if (types[i] === 2) { typeCounts[1] = typeCounts[1] + 1; } else if (types[i] === 3) { typeCounts[2] = typeCounts[2] + 1; } else if (types[i] === 4) { typeCounts[3] = typeCounts[3] + 1; } else { typeCounts[4] = typeCounts[4] + 1; } } var maxType = 1; var maxVal = typeCounts[0]; if(typeCounts[1] > maxVal) { maxVal = typeCounts[1]; maxType = 2; } if(typeCounts[2] > maxVal) { maxVal = typeCounts[2]; maxType = 3; } if(typeCounts[3] > maxVal) { maxVal = typeCounts[3]; maxType = 4; } if(typeCounts[4] > maxVal) { maxVal = typeCounts[4]; maxType = 5; } console.log(maxType); /* var maxVal = Math.max(typeCounts[0], typeCounts[1], typeCounts[2], typeCounts[3], typeCounts[4]); if (maxVal === typeCounts[0]) { console.log("1"); } else if (maxVal === typeCounts[1]) { console.log("2"); } else if (maxVal === typeCounts[2]) { console.log("3"); } else if (maxVal === typeCounts[3]) { console.log("4"); } else { console.log("5"); } */ }