import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  }

  public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  }

  public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  } main {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int sum = 0; sum 0 int min = -1; min -1 1 ArrayList<Integer> a = new ArrayList<Integer>(); a new ArrayList<Integer>() for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    } {
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    } int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int [] g = put(b,min); g put(b,min) put b min sum += g[0] sum g[0] g 0 min = g[1] min g[1] g 1 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  } put {
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  } int [] g = new int[2]; g new int[2] 2 if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    } b == -1 b -1 1 {
      g[1] = a;
      g[0] = 1;
      return g;
    } g[1] = a g[1] g 1 a g[0] = 1 g[0] g 0 1 return g; g if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    } a <= b a b {
      g[1] = a;
      g[0] = 1;
      return g;
    } g[1] = a g[1] g 1 a g[0] = 1 g[0] g 0 1 return g; g g[1] = b g[1] g 1 b g[0] = 0 g[0] g 0 0 return g; g int a a int b b public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  }

  public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  }

  public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int sum = 0;
    int min = -1;
    ArrayList<Integer> a = new ArrayList<Integer>();
    for (int i=0; i<n;i++){
      int b = scan.nextInt();
      int [] g = put(b,min);
      sum += g[0];
      min = g[1];
    }
    System.out.println(sum);
  }

  public static int[] put(int a, int b){
    int [] g = new int[2];
    if (b == -1){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    if (a <= b){
      g[1] = a;
      g[0] = 1;
      return g;
    }

    g[1] = b;
    g[0] = 0;
    return g;
  }
}
