import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] damage = new int[n]; for (int i = 0; i < n; i++) { damage[i] = sc.nextInt(); } int[] dp = new int[1 << n]; dp[0] = 100; for (int i = 1; i < (1 << n); i++) { int max = 100; for (int j = 0; j < n; j++) { if ((i & (1 << j)) != 0 && damage[j] < 0) { max += 100; } } for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { continue; } if (dp[i ^ (1 << j)] <= 0) { continue; } dp[i] = Math.max(dp[i], Math.min(dp[i ^ (1 << j)] + damage[j], max)); } } System.out.println(dp[(1 << n) - 1]); } }