import java.io.BufferedInputStream; import java.util.Scanner; public class Main { static final long C = 1000000007; static final int CY = 1000000000; StringBuilder sb; public void calc() { sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); int n = sc.nextInt(); int[] a = new int[n]; for (int i=0; i < n; i++) { a[i] = sc.nextInt(); } long ans = 0; for (int i=1; i < n; i++) { if (a[i-1] > a[i]) { ans++; } } System.out.println(ans); } public static void main(String[] args) { Main main = new Main(); main.calc(); } }