local status=0
local split=0
local n=io.read("*n")
local a=io.read("*n")
for i=1,n-1 do
    b=io.read("*n")
    if a>b then
        if status==1 then
            split=split+1
            status=0
        elseif status==0 then
            status=-1
        end
    elseif a<b then
        if status==-1 then
            split=split+1
            status=0
        elseif status==0 then
            status=1
        end
    end
    a=b
end
print(split+1)