#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("nrtri.in");
ofstream fout ("nrtri.out");
int freq[30001], v[801];
int main()
{
    int i,j,n,nr,mj,dr,st,maxx=0,pos=0;
    fin >> n;
    for(i=1;i<=n;i++)
    {
        fin >> v[i];
        freq[v[i]]++;
        if(v[i]>maxx)
            maxx=v[i];
    }
    j=1;
    for(i=1;i<=maxx;i++)
    {
        if(freq[i]>0)
        {
            while(freq[i]>0)
            {
                v[j]=i;
                j++;
                freq[i]--;
            }
        }
    }
    for(i=1;i<=n-2;i++)
    {
        mj=i+2;
        for(j=i+1;j<=n-1;j++)
        {
            nr=v[i]+v[j];
            cout << nr << " ";
            st=mj;
            dr=n;
            mj=(st+dr)/2;
            while(v[mj]!=nr && st<=dr)
            {
                if(nr>v[mj])
                {
                    st=mj+1;
                    mj=(dr+st)/2;
                }
                else
                {
                    if(nr<v[mj])
                    {
                        dr=mj-1;
                        mj=(dr+st)/2;
                    }
                }
            }
            while(v[mj]==v[mj+1])
            {
                mj++;
            }
                if(mj>j)
                {
                     pos+=mj-j;
                }
        }
    }
    fout << pos;
    return 0;
}