Program Task_16_33;
Var x, max, first_max, count : Longint;
Function St (X : Longint) :Boolean;
Begin
while x Mod 3=0 Do x:=x Div 3;
St :=(x=1);
End;
Begin max := -1; count := 0;
Write('vvedite chislo'); Read(x);
While Not(St(x)) Do
Begin count:=count+1; If x>max Then Begin
max := x;
first_max := count
End;
Write('vvedite chislo'); Read(x)
End;
If count>0
Then Writeln('max=', max, 'count=', count_max)
Else Writeln('posledovatelnost pustaia')
End.