#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {1, -1, 1, 0, -1, 0, 1, -1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long a[500005];
long long sum(long long x) { return (x * (x - 1)) / 2; }
int dp[82][82][82 * 82], n;
vector<long long> v;
long long cal(long long x, long long y, long long z) {
  if (z < 0) return 2000000;
  if (y == v.size()) return sum(n - x + 1);
  if (n - x + 1 < v.size() - y) return 2000000;
  int &r = dp[x][y][z];
  if (r != -1) return r;
  r = 2000000;
  for (int i = 0; i + x <= n; i++) {
    long long p = x + i;
    long long q = v[y];
    long long ind = x + i + 1;
    if (n - ind + 1 < v.size() - y - 1) break;
    int r1 = cal(x + i + 1, y + 1, z - abs(p - q)) + sum(i);
    r = min(r, r1);
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tc, i, j, x, y, cas = 0, k, m, q;
  while (cin >> n) {
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= n; i++) {
      if (a[i] == 1) v.push_back(i);
    }
    memset(dp, -1, sizeof(dp));
    long long s = sum(n - v.size());
    cal(1, 0, sum(n));
    for (i = 0; i <= sum(n); i++) cout << s - cal(1, 0, i) << " ";
    cout << endl;
  }
  return 0;
}
