#include <bits/stdc++.h>
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const int INF = 1e9;
const long long mod = 998244353;
int n, m, a[85], xx[85];
int d[81][81][3201];
int go(int first, int second, int z) {
  if (z < 0) return -INF;
  if (second == m) return (n - first) * (first - m);
  if (d[first][second][z] != -1) return d[first][second][z];
  d[first][second][z] = -INF;
  for (int i = first + 1; i <= n - m + second + 1; i++) {
    d[first][second][z] =
        max(d[first][second][z],
            (i - 1 - first) * (n - m - i + first + 1) +
                go(i, second + 1, z - abs(xx[second + 1] - i)));
  }
  return d[first][second][z];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  memset(d, -1, sizeof(d));
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i]) xx[++m] = i;
  }
  for (int i = 0; i <= n * (n - 1) / 2; i++) cout << go(0, 0, i) / 2 << ' ';
}
