Program Tong_bang_0;

const fi='BAI2.IN1';
      fo='BAI2.OU1';
Var  a,s: array[0..200] of longint;
     n: longint;
     L, R, i,j:integer;
     f: text;

Function Tong0(i, j: byte): Boolean;
var k: byte;

begin
    Tong0:=true;
    if s[j]-s[i-1]<>0 then tong0:=false;

end;

Begin
  Assign(f,fi); reset(f);
  Readln(f,n);

  for i:=1 to n do
    begin
       read(f, a[i]);
       S[i]:=s[i-1]+a[i];
    end;
  L:=1; R:=1;
  for i:=1 to n-1 do
    for j:=i +1 to n do
      if Tong0(i,j) then
        if j-i>R-L then
          Begin
            L:=i; R:=j;

          end;

  assign(f,fo); rewrite(f);
  if L=R then
  writeln(f, 'NO SOLUTION')
  ELSE writeln(f, R-L+1);
  Close(f)

end.
