import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve=fst.foldl' f(1,EQ).(zipWith compare=<<tail).tail
f(k,a)b
  |b==EQ || a==b=(k,a)
  |a==EQ=(k,b)
  |otherwise=(k+1,EQ)