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