#include <bits/stdc++.h>
using namespace std;

int main()
{
    ifstream f1("BAI2_15.INP");
    ofstream f2("BAI2_15.OUT");
    int n,i,s=0,dau,cuoi,f=0;
    f1>>n;
     int a[n+1];
    for ( i=1;i<=n;i++)
    {
        f1>>a[i];
    }
    int max=-1;
    for (dau=1;dau<=n;dau++)
     {for (i=dau;i<=n;i++)
      {
          s=s+a[i];
          if (s==0)
          { cuoi=i;
           if (max<cuoi-dau+1) {max=cuoi-dau+1;}}
      }s=0;
     }
      for (dau=1;dau<=n;dau++)
     {for (i=dau;i<=n;i++)
      {
          s=s+a[i];
          if (s==0)
          { cuoi=i;
           if (cuoi-dau+1==max) { f=1;
                                 break;}}
      } s=0;
        if (f==1){break;}
     }
      if (f==0){f2<<"NO SOLUTION";}
      else f2<<cuoi-dau+1;

     return 0;
}
