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 tmp>0{
    if ope<0{
      ans++
      ope=0
    }else{
      ope=tmp
    }
  }else if tmp<0{
    if ope>0{
      ans++
      ope=0
    }else{
      ope=tmp
    }
  }else{
    ope=0
  }
}
print(ans) 