This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Euzibillahiminesseytanirracim Bismillahirrahmanirrahim
/*
ID:
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define PII pair<int,int>
#define inf 1000000001
using namespace std;
const int N = 250505;
int n, a[501], dp[N], d[N], k[N];
vector<int>v;
int main()
{
	
	cin>>n;
	
	int jem = 0;
	
	for(int i=1;i<=n;i++) {
		
		cin>>a[i];
		jem += a[i];
		
	}
	
	dp[0] = 1;
	
	for(int i=1;i<=n;i++){
		
		for(int j=N;j>=0;j--) dp[j + a[i]] += dp[j];
		
	}
	
	if(jem % 2 != 0 || dp[jem / 2] == 0) return cout<<"0", 0;
	
	for(int i=1;i<=n;i++){
		
		int ans = jem - a[i];
		
		memset(d , 0 , sizeof(d));
		
		for(int j=0;j<=N;j++){
			
			d[j] += dp[j];
			d[j + a[i]] -= d[j];
			
		}
		
		for(int j=0;j<=N;j++){
			
			if( (ans + j) % 2 == 0 && ans - j >= 0 && ( d[(ans - j) / 2] != 0) ){
				
				k[j]++;
				if(k[j] == n) v.pb(j);
				
			}
			
		}
		
	}
	
	cout<<v.size()<<"\n";
	for(auto x:v) cout<<x<<" ";
	
}
/*
6
3 5 7 11 9 13
_________oBBBBB8o   oBBBBBBB8
_____o8BBBBBBBBBBB  BBBBBBBBB8        o88o
___o8BBBBBB**8BBBB  BBBBBBBBBB     oBBBBBBBo
__oBBBBBBB*   ***   BBBBBBBBBB     BBBBBBBBBBo
_8BBBBBBBBBBooooo   *BBBBBBB8      *BB* 8BBBBBBo
_8BBBBBBBBBBBBBBBB8ooBBBBBBB8           8BBBBBBB8
__*BBBBBBBBBBBBBBBBBBBBBBBBBB8 o88BB88BBBBBBBBBBBB
____*BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB8
______**8BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB*
___________*BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB8*
____________*BBBBBBBBBBBBBBBBBBBBBBBB8888**
_____________BBBBBBBBBBBBBBBBBBBBBBB*
_____________*BBBBBBBBBBBBBBBBBBBBB*
______________*BBBBBBBBBBBBBBBBBB8
_______________*BBBBBBBBBBBBBBBB*
________________8BBBBBBBBBBBBBBB8
_________________8BBBBBBBBBBBBBBBo
__________________BBBBBBBBBBBBBBB8
__________________BBBBBBBBBBBBBBBB
__________________8BBBBBBBBBBBBBBB8
__________________*BBBBBBBBBBBBBBBB
__________________8BBBBBBBBBBBBBBBB8
_________________oBBBBBBBBBBBBBBBBBB
________________oBBBBBBBBBBBBBBBBBBB
________________BBBBBBBBBBBBBBBBBBBB
_______________8BBBBBBBBBBBBBBBBBBB8
______________oBBBBBBBBB88BBBBBBBBB8
______________8BBBBBBBBB*8BBBBBBBBB*
______________BBBBBBBBB* BBBBBBBBB8
______________BBBBBBBB8 oBBBBBBBBB*
______________8BBBBBBB  oBBBBBBBB*
______________BBBBBBB*  8BBBBBBB*
_____________8BBBBBB*   BBBBBBB*
____________8BBBBBB8   oBBBBBB8
___________8BBBBBB8    8BBBBBB*
__________oBBBBBB8    BBBBBBB8
__________BBBBBBB8   BBBBBBBB*
_________oBBBBBBB8   BBBBBBBB
_________8BBBBBB8    BBBBBBB*
_________BBBBBB*     8BBBBB*
________oBBBB8       BBBBB*
________oBBB8        BBBB*
________BBBB8       8BBBBo
_______8BBBB*      oBBBBBBo
______8BBBB*       *BBBBBBBB8o
______BBBBB*            *88BBBo
*/
Compilation message (stderr)
bootfall.cpp: In function 'int main()':
bootfall.cpp:57:9: warning: iteration 250505 invokes undefined behavior [-Waggressive-loop-optimizations]
    d[j] += dp[j];
    ~~~~~^~~~~~~~
bootfall.cpp:55:16: note: within this loop
   for(int j=0;j<=N;j++){
               ~^~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |