import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int ans = 0; int C; int sum = 0; HashMap M = new HashMap<>(); for (int i = 0; i < N; i++) { C = scan.nextInt(); M.put(i, C); sum += C; } for (int i = 0; i < N; i++) if (M.get(i) * 10 <= sum) ans++; ans *= 30; System.out.println(ans); } }