The formula is
=MAX(SCAN(1,DROP(UNIQUE(A:A),1),LAMBDA(aa,b,COUNTIF(A:A,b)+aa-1)))-1
Do not place it in column A, since it is the dynamic range of the data. (circular reference)