import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	}
}

 
 

 
 
 
  import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] heights = new int[n]; heights new int[n] n for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			heights[i] = sc.nextInt();
		} {
			heights[i] = sc.nextInt();
		} heights[i] = sc.nextInt() heights[i] heights i sc.nextInt() sc.nextInt sc int ans = 0; ans 0 Stack<Integer> stack = new Stack<>(); stack new Stack<>() for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		} {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		} while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			} !stack.isEmpty() && heights[i] >= stack.peek() !stack.isEmpty() stack.isEmpty() stack.isEmpty stack heights[i] >= stack.peek() heights[i] heights i stack.peek() stack.peek stack {
				stack.pop();
			} stack.pop() stack.pop stack if (stack.isEmpty()) {
				ans++;
			} stack.isEmpty() stack.isEmpty stack {
				ans++;
			} ans++ ans stack.push(heights[i]) stack.push stack heights[i] heights i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] heights = new int[n];
		for (int i = 0; i < n; i++) {
			heights[i] = sc.nextInt();
		}
		int ans = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) {
			while (!stack.isEmpty() && heights[i] >= stack.peek()) {
				stack.pop();
			}
			if (stack.isEmpty()) {
				ans++;
			}
			stack.push(heights[i]);
		}
		System.out.println(ans);
	}
}

 
 

 
 
 
 
