import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class A { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int N = Integer.parseInt(br.readLine()); int[] C = new int[N]; int sum = 0; String[] CString = br.readLine().split(" "); for (int i = 0; i < N; i++) { C[i] = Integer.parseInt(CString[i]); sum = sum + C[i]; } int border = sum / 10; Arrays.sort(C); int count = 0; for (int i = 0; i < N; i++) { if (C[i] <= border) { count++; } else { break; } } System.out.println(count * 30); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } }