http://acm.hdu.edu.cn/showproblem.php?pid=1709
//1306899 2009-04-25 09:13:59 Accepted 1709 78MS 336K 805 B C++ no way 
#include<iostream>
#include
<cmath>
using namespace std;
int main()
{
    
int n;
    
while(cin>>&& n>0)
    
{
        
int i,j,k,N=0;
        
int w[101],temp[10001],outs[10001];
        
for(i=1;i<=n;i++)
        
{
            scanf(
"%d",&w[i]);
            N 
+= w[i];
        }

        
for(i=0;i<=N;i++)
            temp[i] 
= outs[i] = 0;
        outs[
0= 1;
        outs[w[
1]] = 1;
        
for(i=2;i<=n;i++)
        
{
            
for(j=0;j<=N;j++)
            
{
                
if(outs[j] == 1)
                
{
                    temp[j] 
= 1;//标志j出现过
                    temp[j+w[i]] = 1;//加一个
                    temp[abs(j-w[i])] = 1;//减一个
                }

            }

            
for(j=0;j<=N;j++)
            
{
                outs[j] 
= temp[j];
                temp[j] 
= 0;
            }

        }

        k 
= 0;
        
for(i=1;i<=N;i++)
            
if(outs[i] == 0)
                temp[k
++= i;
        printf(
"%d\n",k);
        
if(k>0)
        
{
            printf(
"%d",temp[0]);
            
for(i=1;i<k;i++)
                 printf(
" %d",temp[i]);
            printf(
"\n");
        }

    }

    
return 0;
}