#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD = 998244353;
void solve(){
int n;
cin >> n;
vector<int> a(n);
int sum = 0;
for(int i = 0; i < n; i++){
cin >> a[i];
sum += a[i];
}
sort(a.rbegin(), a.rend());
ll ans = 0;
int dp1[sum + 1], dp2[sum + 1];
memset(dp1, 0, sizeof dp1);
memset(dp2, 0, sizeof dp2);
dp1[0] = 1;
for(int i = 0; i < n; i++){
int tmp1[sum + 1];
int tmp2[sum + 1];
memset(tmp1, 0, sizeof tmp1);
memset(tmp2, 0, sizeof tmp2);
for(int j = 0; j <= sum; j++){
int rem = max(a[i] - j, j - a[i]);
tmp1[rem] += dp2[j] + dp1[j] * rem;
tmp1[rem] %= MOD;
tmp2[rem] += dp1[j];
tmp2[rem] %= MOD;
}
for(int j = 0; j <= sum; j++){
dp1[j] += tmp2[j];
dp1[j] %= MOD;
dp2[j] += tmp1[j];
dp2[j] %= MOD;
}
}
cout << dp1[2] << "\n";
for(int i = 0; i <= sum; i++){
cout << dp2[i] << " ";
ans += dp2[i];
ans %= MOD;
}
cout << "\n";
cout << ans << "\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
for(int i = 1; i <= t; i++){
solve();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1PRCA9IDk5ODI0NDM1MzsKCnZvaWQgc29sdmUoKXsKCWludCBuOwoJY2luID4+IG47Cgl2ZWN0b3I8aW50PiBhKG4pOwoJaW50IHN1bSA9IDA7CgkKCWZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewoJCWNpbiA+PiBhW2ldOwoJCXN1bSArPSBhW2ldOwoJfQoJCglzb3J0KGEucmJlZ2luKCksIGEucmVuZCgpKTsKCQoJbGwgYW5zID0gMDsKCWludCBkcDFbc3VtICsgMV0sIGRwMltz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