"use strict";
const input = require("fs").readFileSync("/dev/stdin", "utf8");
const inputs = input.trim().split("\n");

const get = (inputs) => {
  const As = inputs.slice(1);
  
  const colors = [];
  let colorNow = 0;
  let colorOldIndex = null;
  
  for (const A of As) {
    const a = +A;
    
    if (!(colorNow < a)) {
      if (colorOldIndex !== null && colorOldIndex !== -1) {
        colors.splice(colorOldIndex, 1);
      }
      colors.push(colorNow);
      colorOldIndex = colors.reverse().findIndex(color => color < a);
    }
    colorNow = a;
  }
  if (As[As.length-2] < +As[As.length-1]) {
    colors.push(colorNow)
  }
  
  return colors.length
}

console.log( get(inputs) );