import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); String[] inputs = reader.readLine().split(" "); long[] votes = new long[N]; long sum = 0; for (int i = 0; i < N; i++) { long v = Long.parseLong(inputs[i]); votes[i] = v; sum += v; } double criteria = sum/ 10.0; long money = 0; for (int i = 0; i < N; i++) { if (votes[i] > criteria) { } else { money += 30; } } System.out.println(money); } }