import java.io.*; import java.util.*; import java.util.stream.*; // 処理 class Process { private int[] C; Process(int[] C) { this.C = C; } int getResult() { int confiscationCriteria = IntStream.of(C).sum() / 10; int count = 0; for(var c : C) { if(c <= confiscationCriteria) { count++; } } return (30 * count); } } public class Main { public static void main(String[] args) throws IOException { var bufferedReader = new BufferedReader(new InputStreamReader(System.in)); var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 int N = Integer.parseInt(bufferedReader.readLine().trim()); int[] C = Stream.of(bufferedReader.readLine().trim().split("[ ]+")).mapToInt(Integer::parseInt).toArray(); // 出力 printWriter.println((new Process(C)).getResult()); bufferedReader.close(); printWriter.close(); } }