#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= int(m); --(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
typedef long long ll;
using namespace std;
template <class T> void setmax(T & a, T const & b) { if (a < b) a = b; }
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
const int inf = 1e9+7;
int main() {
    int n; cin >> n;
    vector<int> s(n+1); repeat (i,n+1) cin >> s[i];
    vector<vector<int> > dp = vectors(n+1, s[n]+1, inf);
    dp[0][0] = 1;
    repeat (i,n+1) {
        repeat (j,s[i]+1) {
            if (i >= 1) {
                setmin(dp[i][j], dp[i-1][j] + 1);
            }
            if (j >= 1) {
                repeat (a,j) {
                    int b = j-a-1;
                    setmin(dp[i][j], dp[i][a] + dp[i][b]);
                }
            }
        }
    }
    repeat (j,s[n]+1) {
        if (j) cout << ' ';
        cout << dp[n][j];
    }
    cout << endl;
    return 0;
}