function main()
  local n = tonumber(io.read())
  local a = {}
  for i in string.gmatch(io.read(), "[^ ]+") do
    table.insert(a, tonumber(i))
  end

  local ans = 0
  local state = 0
  for i = 2, n do
    local diff = a[i] - a[i-1]
    if state > 0 then
      if diff < 0 then
        ans = ans + 1
        state = 0
      end
    elseif state < 0 then
      if diff > 0 then
        ans = ans + 1
        state = 0
      end
    else
      if diff > 0 then
        state = 1
      elseif diff < 0 then
        state = -1
      end
    end
  end
  print(ans + 1)
end

main()
