local n = io.read("*n")
local c = 1
local state = 0
local prv = io.read("*n")
for i = 2, n do
  local nxt = io.read("*n")
  if prv < nxt then
    if state == 0 then
      state = 1
    elseif state < 0 then
      c = c + 1
      state = 0
    end
  elseif nxt < prv then
    if state == 0 then
      state = -1
    elseif 0 < state then
      c = c + 1
      state = 0
    end
  end
  prv = nxt
end
print(c)