let N=Int(readLine()!)!,A=readLine()!.characters.split(" ").map{Int(String($0))!}
var ope=0,ans=1
for i in 1..<N{
  let tmp=A[i]-A[i-1]
  if ope<0&&tmp>0||ope>0&&tmp<0{
    ans++
    ope=0
  }else{
    ope=tmp
  }
}
print(ans) 