
function Main(input) {
    var N = parseInt(input[0], 10);
    var A = input.slice(1).map(a => parseInt(a, 10));

    var colorArray = [];
    var min = 0;
    var minIndex = 0;

    for (var i = 0; i < N; i++) {
        if (i === 0) {
            min = A[i]
            colorArray.push(A[i]);
        } else {
            if (min < A[i]) {
                colorArray[minIndex] = A[i];
                min = Math.min(...colorArray) > A[i] ? A[i] : min;
                minIndex = colorArray.findIndex(num => num === min);
            } else {
                colorArray.push(A[i]);
                min = A[i];
                minIndex = colorArray.length - 1;
            }
        }
    }

    console.log(colorArray.length);
  }

  Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));