import java.util.Arrays; import java.util.Scanner; public class Main_yukicoder266 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int INF = Integer.MAX_VALUE / 2; int n = sc.nextInt(); int[] s = new int[n + 1]; for (int i = 0; i <= n; i++) { s[i] = sc.nextInt(); } int[][] dp = new int[n + 1][10 + 1]; for (int i = 0; i <= n; i++) { Arrays.fill(dp[i], INF); } dp[0][0] = 1; for (int i = 0; i <= n; i++) { for (int j = 0; j <= 10; j++) { if (j > s[i]) { break; } if (i > 0) { dp[i][j] = dp[i - 1][j] + 1; } for (int k = 0; k < j; k++) { for (int l = 0; l < j; l++) { if (j != s[n] && k + l + 1 == j) { dp[i][j] = Math.min(dp[i][j], dp[i][k] + dp[i][l]); } else if (j == s[n] && k + l + 1 >= j) { dp[i][j] = Math.min(dp[i][j], dp[i][k] + dp[i][l]); } } } } } for (int i = 0; i <= s[n]; i++) { if (i > 0) { System.out.print(" "); } System.out.print(dp[n][i]); } System.out.println(""); sc.close(); } }