use std::collections::HashMap;
use std::io;

fn read_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

fn main() {
    let mut board: HashMap<usize, (usize, usize)> = HashMap::new();
    let mut marked = vec![vec![false; 3]; 3];

    for i in 0..3 {
        let x: Vec<usize> = read_line()
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<usize>().unwrap())
            .collect();

        for (j, el) in x.iter().enumerate() {
            board.insert(*el, (i, j));
        }
    }

    let ntc = read_line().trim().parse::<usize>().unwrap();
    for _ in 0..ntc {
        let x = read_line().trim().parse::<usize>().unwrap();
        if board.contains_key(&x) {
            let (i, j) = board.get(&x).unwrap();
            marked[*i][*j] = true;
        }
    }

    let any_line = marked
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    // transpose rows into columns
    let columns: Vec<Vec<bool>> = (0..3)
        .map(|row_idx| {
            marked
                .iter()
                .flatten()
                .skip(row_idx)
                .step_by(3)
                .cloned()
                .collect()
        })
        .collect();

    let any_column = columns
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let first_diag: Vec<bool> = marked.iter().flatten().step_by(4).cloned().collect();
    let second_diag: Vec<bool> = marked.iter().rev().flatten().step_by(4).cloned().collect();

    let diags = vec![first_diag, second_diag];
    let any_diag = diags
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let verifications = vec![any_column, any_diag, any_line];
    if verifications.iter().any(|x| *x == true) == true {
        println!("Yes");
    } else {
        println!("No");
    }
}


use std::collections::HashMap;
use std::io;

fn read_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

fn main() {
    let mut board: HashMap<usize, (usize, usize)> = HashMap::new();
    let mut marked = vec![vec![false; 3]; 3];

    for i in 0..3 {
        let x: Vec<usize> = read_line()
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<usize>().unwrap())
            .collect();

        for (j, el) in x.iter().enumerate() {
            board.insert(*el, (i, j));
        }
    }

    let ntc = read_line().trim().parse::<usize>().unwrap();
    for _ in 0..ntc {
        let x = read_line().trim().parse::<usize>().unwrap();
        if board.contains_key(&x) {
            let (i, j) = board.get(&x).unwrap();
            marked[*i][*j] = true;
        }
    }

    let any_line = marked
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    // transpose rows into columns
    let columns: Vec<Vec<bool>> = (0..3)
        .map(|row_idx| {
            marked
                .iter()
                .flatten()
                .skip(row_idx)
                .step_by(3)
                .cloned()
                .collect()
        })
        .collect();

    let any_column = columns
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let first_diag: Vec<bool> = marked.iter().flatten().step_by(4).cloned().collect();
    let second_diag: Vec<bool> = marked.iter().rev().flatten().step_by(4).cloned().collect();

    let diags = vec![first_diag, second_diag];
    let any_diag = diags
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let verifications = vec![any_column, any_diag, any_line];
    if let Some(true) = verifications.iter().any(|x| x == true) {
        println!("Yes");
    } else {
        println!("No");
    }
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!

    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {

            count += card[j][i] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")

}

main()


import Foundation

let topLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let middleLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let buttomLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let N = Int(readLine()!)!
var numbers: [Int] = []
var hit: [Bool] = [false,false,false,false,false,false,false,false,false]

for i in 0...N - 1{
    numbers.append(Int(readLine()!)!)
}

for i in 0...2 {
    for j in 0...N - 1{
        if topLine[i] == numbers[j]{
            hit[i] = true

        } else if middleLine[i] == numbers[j] {
            hit[i + 3] = true

        } else if buttomLine[i] == numbers[j] {
            hit[i + 6] = true

        }
    }
}

if hit[0] == true && hit[1] == true && hit[2] == true  {
    print("Yes")
} else if hit[3] == true && hit[4] == true && hit[5] == true{
    print("Yes")
} else if hit[6] == true && hit[7] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[3] == true && hit[6] == true{
    print("Yes")
} else if hit[1] == true && hit[4] == true && hit[7] == true{
    print("Yes")
} else if hit[2] == true && hit[5] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[4] == true && hit[8] == true{
    print("Yes")
} else if hit[2] == true && hit[4] == true && hit[6] == true{
    print("Yes")
} else {
    print("No")
}


import Foundation

var bingo_card: [String] = []
var numbers: [String] = []
var bingo_status: [Bool] = []

for i in 0...2 {
  let input_line = readLine()!
  let split: [String] = input_line.componentsSeparatedByString(" ")
  for j in 0...2 {
    bingo_card.append(split[j])
  }
}

let numOfNumbers = Int(readLine()!)!

for i in 0...numOfNumbers-1 {
  numbers.append(readLine()!)
}

for i in 0...bingo_card.count-1 {
  var status = false
  for j in 0...numbers.count-1 {
    if numbers[j] == bingo_card[i] {
      status = true
    }
  }

  bingo_status.append(status)
}

if bingo_status[0] && bingo_status[1] && bingo_status[2] {
  print("Yes")
} else if bingo_status[3] && bingo_status[4] && bingo_status[5] {
  print("Yes")
} else if bingo_status[6] && bingo_status[7] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[3] && bingo_status[6] {
  print("Yes")
} else if bingo_status[1] && bingo_status[4] && bingo_status[7] {
  print("Yes")
} else if bingo_status[2] && bingo_status[5] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[4] && bingo_status[8] {
  print("Yes")
} else if bingo_status[2] && bingo_status[4] && bingo_status[6] {
  print("Yes")
} else {
  print("No")
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!

    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    print(card)
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {

            count += card[j][i] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")

}

main()


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!

    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }

    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {

            count += card[i][j] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")

}

main()


import Foundation

var bingo_card: [String] = []
var numbers: [String] = []
var bingo_status: [Bool] = []

for i in 0...2 {
  let input_line = readLine()!
  let split: [String] = input_line.componentsSeparatedByString(" ")
  for j in 0...2 {
    bingo_card.append(split[j])
  }
}

print(bingo_card)

let numOfNumbers = Int(readLine()!)!

print(numOfNumbers)

for i in 0...numOfNumbers-1 {
  numbers.append(readLine()!)
}

print(numbers)

for i in 0...bingo_card.count-1 {
  var status = false
  for j in 0...numbers.count-1 {
    if numbers[j] == bingo_card[i] {
      status = true
    }
  }

  bingo_status.append(status)
}

print(bingo_status)

if bingo_status[0] && bingo_status[1] && bingo_status[2] {
  print("Yes")
} else if bingo_status[3] && bingo_status[4] && bingo_status[5] {
  print("Yes")
} else if bingo_status[6] && bingo_status[7] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[3] && bingo_status[6] {
  print("Yes")
} else if bingo_status[1] && bingo_status[4] && bingo_status[7] {
  print("Yes")
} else if bingo_status[2] && bingo_status[5] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[4] && bingo_status[8] {
  print("Yes")
} else if bingo_status[2] && bingo_status[4] && bingo_status[6] {
  print("Yes")
} else {
  print("No")
}


function Main(input) {
    const lines = input.split("\n");
    let cells = [lines.shift(), lines.shift(), lines.shift()];
    cells = cells.map(l => l.split(' '));

    const n = lines.shift();

    try {
        lines.forEach(b => {
            cells.forEach(row => {
                row.forEach((a, j) => {
                    if (a == b) {
                        row[j] = true;
                        if (row[0] === row[1] === row[2] ||
                            cells[0][j] === cells[1][j] === cells[2][j] ||
                            cells[0][0] === cells[1][1] === cells[2][2] ||
                            cells[0][2] === cells[1][1] === cells[2][0]
                        ) {
                            throw 1;
                        }
                    }
                });
            });
        });
        console.log('No');
    } catch(_) {
        console.log('Yes');
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let obj:any ={}
  let obj2:any ={}
  for(let i=0;i<9;i++){
    obj[o.n()] = i;
  }
  // 0 1 2
  // 3 4 5
  // 6 7 8
  let n=o.n()
  for(let i=0;i<n;i++){
    let t = o.n()
    if(obj[t] !== undefined){

      obj2[obj[t]] = 1;
    }
  }
  if(obj2[0]&&obj2[1]&&obj2[2]
    || obj2[3]&&obj2[4]&&obj2[5]
    || obj2[6]&&obj2[7]&&obj2[8]
    || obj2[0]&&obj2[3]&&obj2[6]
    || obj2[1]&&obj2[4]&&obj2[7]
    || obj2[2]&&obj2[5]&&obj2[8]
    || obj2[0]&&obj2[4]&&obj2[8]
    || obj2[2]&&obj2[4]&&obj2[6]
    ){
      o.Yes()
    }else{
      o.No()
    }
}
m();


import * as fs from 'fs';

//in
// 60 88 34
// 92 41 43
// 65 73 48
// 10
// 60
// 43
// 88
// 11
// 48
// 73
// 65
// 41
// 92
// 34
//out
// Yes
const main = (inp: string) => {
    let inpList: string[] = inp.split('\n');

    let a1: number[] = inpList[0].split(' ').map(Number);
    let a2: number[] = inpList[1].split(' ').map(Number);
    let a3: number[] = inpList[2].split(' ').map(Number);

    inpList.shift();
    inpList.shift();
    inpList.shift();

    const n: number = parseInt(inpList[0]);

    inpList.shift();

    for (let i: number = 0; i < n; i++) {
        if (a1[0] === parseInt(inpList[i])) {
            a1[0] = 0;
        }
        if (a1[1] === parseInt(inpList[i])) {
            a1[1] = 0;
        }
        if (a1[2] === parseInt(inpList[i])) {
            a1[2] = 0;
        }
        if (a2[0] === parseInt(inpList[i])) {
            a2[0] = 0;
        }
        if (a2[1] === parseInt(inpList[i])) {
            a2[1] = 0;
        }
        if (a2[2] === parseInt(inpList[i])) {
            a2[2] = 0;
        }
        if (a3[0] === parseInt(inpList[i])) {
            a3[0] = 0;
        }
        if (a3[1] === parseInt(inpList[i])) {
            a3[1] = 0;
        }
        if (a3[2] === parseInt(inpList[i])) {
            a3[2] = 0;
        }
    }

    if (a1[0]===0 && a1[1]===0 && a1[2]===0) {
        console.log('Yes');
        return;
    }
    if (a2[0]===0 && a2[1]===0 && a2[2]===0) {
        console.log('Yes');
        return;
    }
    if (a3[0]===0 && a3[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[0]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    if (a1[1]===0 && a2[1]===0 && a3[1]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[2]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }

    if (a1[0]===0 && a2[1]===0 && a3[2]===0) {
        console.log('Yes');
        return;
    }
    if (a1[2]===0 && a2[1]===0 && a3[0]===0) {
        console.log('Yes');
        return;
    }
    console.log('No');

};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());


function main(input) {
  const inputs =input.split('\n')
  const A = inputs.slice(0, 3).map(e => e.split(' ').map(Number))
  const [N] = inputs.slice(3, 4).map(Number)
  const B = inputs.slice(4).map(Number)

  let t = Array.from(A)
  for (let i = 0; i < B.length; i++) {
    t.forEach(e => {
      let ind = e.indexOf(B[i])
      if (ind !== -1) {
        e[ind] = 0
      }
    })
  }
  if (t[0][1] + t[0][0] + t[0][2] === 0 ||
    t[1][0] + t[1][1] + t[1][2] === 0 ||
    t[2][0] + t[2][1] + t[2][2] === 0 ||
    t[0][2] + t[1][2] + t[2][2] === 0 ||
    t[0][0] + t[1][1] + t[2][2] === 0 ||
    t[0][1] + t[1][1] + t[2][1] === 0 ||
    t[0][2] + t[1][1] + t[2][0] === 0 ||
    t[1][0] + t[1][1] + t[1][2] === 0
  ) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())


import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let obj:any ={}
  let obj2:any ={}
  for(let i=0;i<9;i++){
    obj[o.n()] = i;
  }
  // 0 1 2
  // 3 4 5
  // 6 7 8
  let n=o.n()
  for(let i=0;i<n;i++){
    let t = o.n()
    if(obj[t] !== undefined){

      obj2[obj[t]] = 1;
    }
  }
  o.o(obj2)
  if(obj2[0]&&obj2[1]&&obj2[2]
    || obj2[3]&&obj2[4]&&obj2[5]
    || obj2[6]&&obj2[7]&&obj2[8]
    || obj2[0]&&obj2[3]&&obj2[6]
    || obj2[1]&&obj2[4]&&obj2[7]
    || obj2[2]&&obj2[5]&&obj2[8]
    || obj2[0]&&obj2[4]&&obj2[8]
    || obj2[2]&&obj2[4]&&obj2[6]
    ){
      o.Yes()
    }else{
      o.No()
    }
}
m();


import sys

def resolve(in_):
    N = int(next(sys.stdin.buffer))
    P = map(int, next(sys.stdin.buffer).split())

    min_ = 200001
    ans = 0
    for p in P:
        if p <= min_:
            ans += 1
            min_ = p
    return ans

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)

if __name__ == '__main__':
    main()


def main():
    n = int(input())
    p = map(int, input().split())

    num = float('inf')
    r = 0
    for pe in p:
        if num >= pe:
            r += 1
            num = pe
    print(r)

if __name__ == '__main__':
    main()


def main():
    n = int(input())
    min_num = 10 ** 9
    ans = 0
    for p in map(int, input().split()):
        if p < min_num:
            ans += 1
            min_num = p
    print(ans)

if __name__ == '__main__':
    main()


n = int(input())
p = list(map(int, input().split()))

min = p[1]
count = 1

for i in range(1,n):
    if p[i] <= min:
        count += 1
        min = p[i]

print(count)


n = int(input())
p = list(map(int, input().split()))
ans = 1

for i in range(1,n):
    if min(p[0:i]) >= p[i]:
        ans += 1

print(ans)


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n = k()
p = l()

for i in range(1, len(p)):
  if p[i-1] >= p[i]:
    cnt += 1

print(cnt+1)


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
public class Main {
	public static void main(String[] args) {
		try {
			BufferInput in = new BufferInput();
			StringBuilder sb = new StringBuilder();
			int n = in.nextInt();
			int min = Integer.MAX_VALUE;
			int ans = 0;
			for(int i=0;i<n;i++) {
				int a = in.nextInt();
				if(a<min) {
					min = a;
					ans++;
				}
			}
			System.out.println(ans);
		}catch(Exception e) {}

	}
static class BufferInput {

		final private int BUFFER_SIZE = 1 << 16;

		private DataInputStream din;

		private byte[] buffer;

		private int bufferPointer, bytesRead;

		public BufferInput() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public BufferInput(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[64];
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public String nextString() throws IOException{

			byte c = read();
			while(Character.isWhitespace(c)){
				c = read();
			}

			StringBuilder builder = new StringBuilder();
			builder.append((char)c);
			c = read();
			while(!Character.isWhitespace(c)){
				builder.append((char)c);
				c = read();
			}

			return builder.toString();
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public int[] nextIntArray(int n) throws IOException {
			int arr[] = new int[n];
			for(int i = 0; i < n; i++){
				arr[i] = nextInt();
			}
			return arr;
		}
		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			long arr[] = new long[n];
			for(int i = 0; i < n; i++){
				arr[i] = nextLong();
			}
			return arr;
		}

		public char nextChar() throws IOException{
			byte c = read();
			while(Character.isWhitespace(c)){
				c = read();
			}
			return (char) c;
		}
		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}
		public double[] nextDoubleArray(int n) throws IOException {
			double arr[] = new double[n];
			for(int i = 0; i < n; i++){
				arr[i] = nextDouble();
			}
			return arr;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}


// Utilities
import java.io.*;
import java.util.*;
public class Main {
  static int N;
  static int res = 0;

  public static void main(String[] args) throws IOException {
    INPUT in = new INPUT(System.in);
    N = in.iscan();
    int x, curMin = Integer.MAX_VALUE;
    for (int i = 0; i < N; i++){
      x = in.iscan();
      if (x < curMin){
        curMin = x;
        res++;
      }
    }
    System.out.println(res);
  }

  private static class INPUT {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

		public INPUT (InputStream stream) {
			this.stream = stream;
		}

		public INPUT (String file) throws IOException {
			this.stream = new FileInputStream (file);
		}

		public int cscan () throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read (buf);
			}

			if (numChars == -1)
				return numChars;

			return buf[curChar++];
		}

		public int iscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			int res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public String sscan () throws IOException {
			int c = cscan ();

			while (space (c))
				c = cscan ();

			StringBuilder res = new StringBuilder ();

			do {
				res.appendCodePoint (c);
				c = cscan ();
			}
			while (!space (c));

			return res.toString ();
		}

		public double dscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			double res = 0;

			while (!space (c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * UTILITIES.fast_pow (10, iscan ());

				res *= 10;
				res += c - '0';
				c = cscan ();
			}

			if (c == '.') {
				c = cscan ();
				double m = 1;

				while (!space (c)) {
					if (c == 'e' || c == 'E')
						return res * UTILITIES.fast_pow (10, iscan ());

					m /= 10;
					res += (c - '0') * m;
					c = cscan ();
				}
			}

			return res * sgn;
		}

		public long lscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			long res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public boolean space (int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

	public static class UTILITIES {

		static final double EPS = 10e-6;

		public static int lower_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] >= x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int upper_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] > x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int gcd (int a, int b) {
			return b == 0 ? a : gcd (b, a % b);
		}

		public static int lcm (int a, int b) {
			return a * b / gcd (a, b);
		}

		public static long fast_pow_mod (long b, long x, long mod) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;

			return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;
		}

		public static long fast_pow (long b, long x) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow (b * b, x / 2);

			return b * fast_pow (b * b, x / 2);
		}

		public static long choose (long n, long k) {
			k = Math.min (k, n - k);
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = val * (n - i) / (i + 1);

			return val;
		}

		public static long permute (int n, int k) {
			if (n < k) return 0;
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = (val * (n - i));

			return val;
		}
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
// import java.awt.Point;

public class Main {
    InputStream is;
    PrintWriter out;
    String INPUT = "";

    static int mod = 1_000_000_007;
    // int mod = 998244353;
    // long inf = Long.MAX_VALUE/2;
    int inf = Integer.MAX_VALUE/2;

    void solve(){
        int n = ni();
        int mi = n+1;
        int ans = 0;
        for(int i = 0; i < n; i++){
            int val = ni();
            if(mi>val){
                ans++;
            }
            mi = Math.min(mi, val);
        }
        out.println(ans);
    }

    void run() throws Exception
    {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        out.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    private int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b) && b != ' ')){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }

}


import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    int array[] = new int[num];
    int array_max[] = new int[num];
    int max = 0;
    for(int i = 0;i < num;i++){
      array[i] = sc.nextInt();
      if(max < array[i]){
        max = array[i];
      }
      array_max[i] = max;
    }
    int count = 0;
    for(int i = 0;i < num;i++){
      if(array_max[i] >= array[i]){
        count++;
      }
    }
    System.out.println(count);
  }
}


import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    int array[] = new int[num];
    for(int i = 0;i < num;i++){
      array[i] = sc.nextInt();
    }
    int count = 0;
    for(int i = 0;i < num;i++){
      boolean flag = true;
      for(int j = 0;j <= i;j++){
        if(array[j] <= array[i]){
          flag = false;
        }
      }
      if(flag){
        count++;
      }
    }
    System.out.println(count);
  }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] p = new int[n];
    int count = 0;
    for(int i=0; i<n; i++) {
      p[i] = Integer.parseInt(str[i]);
      for(int j=0; j<i; j++) {
        if(p[i]-p[j]>0) {
          count++;
          break;
        }
      }
    }
    System.out.println(n-count);
  }
}


#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint();

	int mae = 1e9;
	int kotae = 0;
	rep(i, N) {
		int p = getint();

		if (mae > p) {
			kotae++;
			mae = p;
		}
	}
	printf("%d\n", kotae);

	Would you please return 0;
}


#include <bits/stdc++.h>
#include <unistd.h>
using i64 = std::int64_t;
namespace io { constexpr int is = 1 << 17; char ib[is], *ip = ib + is, it; inline char getc() { if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; } return *ip++; } inline i64 scan() { i64 r = 0; if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0'; else while ((it = *ip++) & 16) r = r * 10 + it - '0'; return r; } constexpr int os = 1 << 17; char ob[os], *op = ob, ot; inline void putc(const char c) { *op++ = c; if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; } } /* x shoud be greater than or equal to zero */ inline void print(i64 x) { char d[20]; int i = 0; while (true) { d[i] = x % 10 + 48; x /= 10; ++i; if (x <= 0) break; } while (i--) { putc(d[i]); } } inline void flush() { write(STDOUT_FILENO, ob, op - ob); } }
signed main() {
  i64 n = io::scan();
  i64 c = 0;
  i64 m = n;
  for (int i = 0; i < n; i++) {
    i64 x = io::scan();
    if (x <= m) {
      c++;
      m = x;
    }
  }
  io::print(c);
  io::flush();
}


#pragma GCC target("sse,sse2,sse3,sse4.1,sse4.2,popcnt,abm,mmx,avx")
#pragma comment(linker,"/STACK:102400000,102400000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
using namespace std;
namespace IO{
#define BUF_SIZE 100000
#define OUT_SIZE 100000
#define ll long long
    //fread->read
    bool IOerror=0;
    inline char nc(){
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
            //{printf("IO error!\n");system("pause");for (;;);exit(0);}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline void read(int &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(ll &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(double &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (ch=='.'){
            double tmp=1; ch=nc();
            for (;ch>='0'&&ch<='9';ch=nc())tmp/=10.0,x+=tmp*(ch-'0');
        }
        if (sign)x=-x;
    }
    inline void read(char *s){
        char ch=nc();
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
        *s=0;
    }
    inline void read(char &c){
        for (c=nc();blank(c);c=nc());
        if (IOerror){c=-1;return;}
    }
    //fwrite->write
    struct Ostream_fwrite{
        char *buf,*p1,*pend;
        Ostream_fwrite(){buf=new char[BUF_SIZE];p1=buf;pend=buf+BUF_SIZE;}
        void out(char ch){
            if (p1==pend){
                fwrite(buf,1,BUF_SIZE,stdout);p1=buf;
            }
            *p1++=ch;
        }
        void print(int x){
            static char s[15],*s1;s1=s;
            if (!x)*s1++='0';if (x<0)out('-'),x=-x;
            while(x)*s1++=x%10+'0',x/=10;
            while(s1--!=s)out(*s1);
        }
        void println(int x){
            static char s[15],*s1;s1=s;
            if (!x)*s1++='0';if (x<0)out('-'),x=-x;
            while(x)*s1++=x%10+'0',x/=10;
            while(s1--!=s)out(*s1); out('\n');
        }
        void print(ll x){
            static char s[25],*s1;s1=s;
            if (!x)*s1++='0';if (x<0)out('-'),x=-x;
            while(x)*s1++=x%10+'0',x/=10;
            while(s1--!=s)out(*s1);
        }
        void println(ll x){
            static char s[25],*s1;s1=s;
            if (!x)*s1++='0';if (x<0)out('-'),x=-x;
            while(x)*s1++=x%10+'0',x/=10;
            while(s1--!=s)out(*s1); out('\n');
        }
        void print(double x,int y){
            static ll mul[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,
                             1000000000,10000000000LL,100000000000LL,1000000000000LL,10000000000000LL,
                             100000000000000LL,1000000000000000LL,10000000000000000LL,100000000000000000LL};
            if (x<-1e-12)out('-'),x=-x;x*=mul[y];
            ll x1=(ll)floor(x); if (x-floor(x)>=0.5)++x1;
            ll x2=x1/mul[y],x3=x1-x2*mul[y]; print(x2);
            if (y>0){out('.'); for (size_t i=1;i<y&&x3*mul[i]<mul[y];out('0'),++i); print(x3);}
        }
        void println(double x,int y){print(x,y);out('\n');}
        void print(char *s){while (*s)out(*s++);}
        void println(char *s){while (*s)out(*s++);out('\n');}
        void flush(){if (p1!=buf){fwrite(buf,1,p1-buf,stdout);p1=buf;}}
        ~Ostream_fwrite(){flush();}
    }Ostream;
    inline void print(int x){Ostream.print(x);}
    inline void println(int x){Ostream.println(x);}
    inline void print(char x){Ostream.out(x);}
    inline void println(char x){Ostream.out(x);Ostream.out('\n');}
    inline void print(ll x){Ostream.print(x);}
    inline void println(ll x){Ostream.println(x);}
    inline void print(double x,int y){Ostream.print(x,y);}
    inline void println(double x,int y){Ostream.println(x,y);}
    inline void print(char *s){Ostream.print(s);}
    inline void println(char *s){Ostream.println(s);}
    inline void println(){Ostream.out('\n');}
    inline void flush(){Ostream.flush();}
#undef ll
#undef OUT_SIZE
#undef BUF_SIZE
};
using namespace IO;
#define ll long long
#define ull unsigned long long
/*------------------Coding Area------------------*/
signed main()
{
    int n,maxp,inn;
    int ans=1;
    read(n);
    read(maxp);
    for(int i=2;i<=n;++i)
    {
        read(inn);
        if(inn<=maxp)
            ++ans;
        maxp=min(maxp,inn);
    }
    println(ans);
    return 0;
}


e


fdsfsdafsda


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const int MAXN = 201+5;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin >> a[i];
	}
	ll ans = 1;
	ll mini = a[0];
	for(ll i=1; i<n; i++){
		if(mini>a[i]){
			ans++;
			a[i]=mini;
		}
	}
	cout << ans << "\n";
	return 0;
}

//^-^


// ABC 152-C
// 2020.1.19 bal4u

#include <stdio.h>

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int main()
{
	int N, P, mi, ans;

	mi = 0x5fffffff, ans = 0;
	N = in();
	while (N--) {
		P = in();
		if (mi > P) mi = P;
		if (mi >= P) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int N;
	int *P;
	int i;
	int min_till_i;
	int answer;
	char buf_N[16];
	char *buffer;
	char *ch;

	fgets(buf_N, sizeof(buf_N), stdin);
	ch = strtok(buf_N, " ");
	N = atoi(ch);

	P = (int *)calloc(N, sizeof(int));
	buffer = (char *)calloc(N * N + 1, sizeof(char));

	fgets(buffer, N * N + 1, stdin);
	ch = strtok(buffer, " ");
	P[0] = atoi(ch);
	for(i = 1; i < N; i += 1) {
		ch = strtok(NULL, " ");
		if(NULL == ch) {
			printf("sth wrong:%d\n", i);
			break;
		}
		P[i] = atoi(ch);
	}

	min_till_i = N;
	answer = 0;
	for(i = 0; i < N; i += 1) {
		if(min_till_i >= P[i]) {
			min_till_i = P[i];
		}
		if(P[i] <= min_till_i) {
			answer += 1;
		}
	}

	printf("%d\n", answer);

	free(P);
	free(buffer);
	return 0;
}


#include <stdio.h>

unsigned int n, v;
unsigned int cnt = 0;
unsigned int min = 1U << 30;

unsigned int read(void){
  char c;
  while(1){
    c = getchar();
    if(c >= '0') break;
  }
  unsigned int res = c - '0';
  while(1){
    c = getchar();
    if(c < '0') break;
    res = 10 * res + (c - '0');
  }
  return res;
}

int main(void){
  n = read();
  while(n--){
    v = read();
    if(v < min){
      min = v; cnt++;
    }
  }
  printf("%u\n", cnt);
  return 0;
}


#include <stdio.h>

int main(void)
{
    int n=0,count=0,flag=0;
    int P[200000]={};
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&P[i]);
    }
    for(int i=0;i<n;i++){
        flag=0;
        for(int j=0;j<=i;j++){
            if(P[i]>P[j]){
                flag=1;
                break;
            }
        }
        if(flag==0){
            count+=1;
        }
    }
    printf("%d",count);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

const int inf = 1012345678;
int main(){
    int n;
    int p[200005];

    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &p[i]);
    }

    int flag = 0;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        flag = 0;
        for(int j = i; j >= 0; --j){
            if(p[i] <= p[j]){
                flag = 1;
            }else{
                flag = 0;
                break;
            }
        }
        if(flag){
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}


#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    int p[n],c=0;
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        for(j=0;j<i;j++){
            if(p[i]>p[j]){
                c++;
              break;
            }
        }
    }
    printf("%d\n",n-c);
}


function Main(input) {
    input = input.split("\n");
    tmp = input[1].split(" ");
    all = Number(input[0]);
    var maxest = Number(tmp[0]);
    ans = 1;
    for(i = 2; i <= all; i++){
        the_Num = Number(tmp[i-1]);
        if(maxest >= the_Num){
            ans++;
        }
        if(maxest > the_Num) maxest = the_Num;

    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	var n = parseInt(input[0], 10);
    var str = input[1];
    var suu = str.split(" ");
    for(var i=0; i<n; i++){
      suu[i] = parseInt(suu[i], 10);
    }
    var count = 0;
    var min = 200001;
  	for(var i=0; i<n; i++){
      if(suu[i] < min){
        count++;
        min = suu[i];
      }
    }
  console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0]-0;
  const P=input[1].split(' ').map(e=>{
    return e-0;
  });
  var min=Infinity;
  var ret=0;
  P.forEach(e=>{
    if(min>=e){
      ret++;
      min=e;
    }
  });
  console.log(ret);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function *main() {

  const N = parseInt((yield), 10);
  const P = (yield).split(" ").map(s => parseInt(s, 10));
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);

}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));


function *main() {

  const N = parseInt(yield, 10);
  const P = yield.trim().split(" ").map(s => parseInt(yield, 10));
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);

}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));


function *main() {

  const N = +(yield);
  const P = (yield).trim().split(" ").map(s => +s);
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);

}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));


package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n := scanInt(sc)
	p := scanIntSlice(sc, n)
	fmt.Println(resolve(n, p))
}

func resolve(n int, p []int) int {
	count := 0

	min := math.MaxInt64
	for i := 0; i < n; i++ {
		if p[i] < min {
			count++
			min = p[i]
		}
	}

	return count
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var maxInt = int(1e18)

func main() {
	n := readI()
	min := maxInt
	ans := 0
	for i := 0; i < n; i++ {
		p := readI()
		if min >= p {
			min = p
			ans++
		}
	}
	fmt.Println(ans)
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"math"
	"os"
	"reflect"
	"strconv"
)

func main() {
	sc := NewBufScanner(os.Stdin)
	n:= sc.Int()

	min := 200000
	var cnt int
	for i := 0; i < n; i++ {

		p := sc.Int()
		if min >= p {
			min = p
			cnt++
		}
	}
	fmt.Println(cnt)

}

type BufScanner struct {
	*bufio.Scanner
}

func NewBufScanner(r io.Reader) *BufScanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	// s.Split(scanWords)
	return &BufScanner{s}
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i+1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}

func (s *BufScanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *BufScanner) Int() int {
	return int(s.UInt())
}

func (s *BufScanner) UInt() uint64 {
	s.Scan()
	i, e := strconv.ParseUint(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (s *BufScanner) Float64() float64 {
	s.Scan()
	i, e := strconv.ParseFloat(s.Text(),64)
	if e != nil {
		panic(e)
	}
	return i
}

func (s *BufScanner) ArrayInt(n int) (r []int) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int())
	}
	return
}

///////////////

// FullScanner for stdin
type FullScanner struct {
	*bytes.Buffer
}

func NewFullScanner(r io.Reader) *FullScanner {
	b, err := ioutil.ReadAll(r)
	if err != nil {
		panic(err)
	}
	buf := bytes.NewBuffer(b)
	return &FullScanner{buf}
}

func (s *FullScanner) Int() (r int) {
	fmt.Fscan(s, &r)
	return
}

// Scanner for stdin
type Scanner struct {
}

func NewScanner() *Scanner {
	return &Scanner{}
}

func (s *Scanner) Text() (r string) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) UInt() (r uint64) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) Int() (r int) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) UInt32() (r uint32) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) Int32() (r int32) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) Double() (r float64) {
	fmt.Scan(&r)
	return
}

func (s *Scanner) ArrayText(n int) (r []string) {
	for i := 0; i < n; i++ {
		r = append(r, s.Text())
	}
	return
}

func (s *Scanner) ArrayInt(n int) (r []int) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int())
	}
	return
}

func (s *Scanner) ArrayDouble(n int) (r []float64) {
	for i := 0; i < n; i++ {
		r = append(r, s.Double())
	}
	return
}

func arrayIntToArrayString(arr []int) (r []string) {
	for _, v := range arr {
		r = append(r, fmt.Sprintf("%d", v))
	}
	return
}

func arrayStringToArrayInt(arr []string) (r []int) {
	for _, v := range arr {
		i, e := strconv.ParseInt(v, 10, 64)
		if e != nil {
			panic(e)
		}
		r = append(r, int(i))
	}
	return
}

func Sum(arr ...int) (sum int) {
	for _, x := range arr {
		sum += x
	}
	return
}

// https://gobyexample.com/collection-functions
func AllInt(vs []int, f func(int) bool) bool {
	for _, v := range vs {
		if !f(v) {
			return false
		}
	}
	return true
}

// --
//  I/O utilities
//

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

var out = bufio.NewWriter(os.Stdout)
func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// --
// math flavor typical theories
//

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}
func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100 は10に10を1回掛けること
	// つまり初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}

// http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html
func abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}

// --
// Algorithms Utility Zone
//

func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}


package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)

	var count int = 0
	var flag int = 0
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
		flag = 0
		for j := 0; j < i; j++ {
			if P[i] > P[j] {
				flag = 1
				break
			}
		}
		if flag == 1 {
			flag = 0
		} else {
			count++
		}
	}

	fmt.Println(count)
}


package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
	}

	var count int = 0
	var flag int = 0
	for i := 0; i < N; i++ {
		flag = 0
		for j := 0; j < i; j++ {
			if P[i] > P[j] {
				flag = 1
				break
			}
		}
		if flag == 1 {
			flag = 0
		} else {
			count++
		}
	}

	fmt.Println(count)
}


package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
  var N, A, ANS int
  N = scanInt()
  l := make([]int, N)
  ANS = N
  for i := 0; i < N; i++ {
	  A = scanInt()
	  l[i] = A
  }
  for i := 0; i < N; i++ {
    for j := 0; j <= i; j++ {
		if l[i] > l[j] {
			ANS--
			break
		}
	}
  }
  fmt.Println(ANS)
}


require 'pp'

n  = gets.chomp!.to_i
p_n = gets.chomp!.split.map(&:to_i)

count = 0
min = p_n[0]
p_n.each do |a|
    if a <= min
        count += 1
        min = a
    end
end

puts count


n = gets.to_i

arr = gets.split(' ').map!(&:to_i)

min = arr[0]
count = 0

arr.each do |e|
  if min >= e
    count += 1
    min = e
  end
end

puts count


N,*ps=$<.read.split.map(&:to_i)

min = ps[0]
ret = 0

ps.each do |p|
  if p <= min
    ret += 1
    min = p
  end
end

p ret


n=gets.to_i
p=gets.split.map(&:to_i)

count=1
(n-1).times do |i|
    if p[i]>p[i+1]
        count+=1
    end
end
puts count


n=gets.to_i
p=gets.split.map(&:to_i)

count=0
while p.length>0
    p.length.times do |i|
        if p[i]==p.min
            p=p[0, i]
            count+=1
            break
        end
    end
end
puts count


#全探索＝＝TLE（たぶん）
N = gets.to_i
num = gets.strip.split.map(&:to_i)
ary = Array.new(N,0)
ary[0] = num[0]
s = 1
for i in 1..N-1
  if ary[i-1] > num[i]
    ary[i] = num[i]
    s += 1
  end
end
puts s


#[macro_use]
mod input_mcr {
    // ref: tanakh <https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8>
    // diff: using Parser
    #[macro_export(local_inner_macros)]
    macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut parser = Parser::from_str($s);
        input_inner!{parser, $($r)*}
    };
    (parser = $parser:ident, $($r:tt)*) => {
        input_inner!{$parser, $($r)*}
    };
    (new_stdin_parser = $parser:ident, $($r:tt)*) => {
        let stdin = std::io::stdin();
        let reader = std::io::BufReader::new(stdin.lock());
        let mut $parser = Parser::new(reader);
        input_inner!{$parser, $($r)*}
    };
    ($($r:tt)*) => {
        input!{new_stdin_parser = parser, $($r)*}
    };
}

    #[macro_export(local_inner_macros)]
    macro_rules! input_inner {
    ($parser:ident) => {};
    ($parser:ident, ) => {};
    ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($parser, $t);
        input_inner!{$parser $($r)*}
    };
}

    #[macro_export(local_inner_macros)]
    macro_rules! read_value {
    ($parser:ident, ( $($t:tt),* )) => {
        ( $(read_value!($parser, $t)),* )
    };
    ($parser:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($parser, $t)).collect::<Vec<_>>()
    };
    ($parser:ident, chars) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()
    };
    ($parser:ident, char_) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()[0]
    };
    ($parser:ident, usize1) => {
        read_value!($parser, usize) - 1
    };
    ($parser:ident, i64_) => {
        $parser.fast_i64()
    };
    ($parser:ident, usize_) => {
        $parser.fast_i64() as usize
    };
    ($parser:ident, usize1_) => {
        ($parser.fast_i64() - 1) as usize
    };
    ($parser:ident, $t:ty) => {
        $parser.next::<$t>().expect("Parse error")
    };
}

    use std::io;
    use std::io::BufRead;
    use std::str;

    // ref: tatsuya6502 <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e>
    // ref: wariuni <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e#comment-7040a5ae96305e884eb9>
    // diff: using std::io::BufRead::fill_buf()
    pub struct Parser<R> {
        pub reader: R,
        buf: Vec<u8>,
        pos: usize,
    }

    impl Parser<io::Empty> {
        pub fn from_str(s: &str) -> Parser<io::Empty> {
            Parser {
                reader: io::empty(),
                buf: s.as_bytes().to_vec(),
                pos: 0,
            }
        }
    }

    impl<R: BufRead> Parser<R> {
        pub fn new(reader: R) -> Parser<R> {
            Parser {
                reader: reader,
                buf: vec![],
                pos: 0,
            }
        }
        pub fn update_buf(&mut self) {
            self.buf.clear();
            self.pos = 0;
            loop {
                let (len, complete) = {
                    let buf2 = self.reader.fill_buf().unwrap();
                    self.buf.extend_from_slice(buf2);
                    let len = buf2.len();
                    (len, buf2[len - 1] <= 0x20)
                };
                self.reader.consume(len);
                if complete {
                    break;
                }
            }
        }
        pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
            loop {
                let mut begin = self.pos;
                while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                    begin += 1;
                }
                let mut end = begin;
                while end < self.buf.len() && (self.buf[end] > 0x20) {
                    end += 1;
                }
                if begin != self.buf.len() {
                    self.pos = end;
                    return unsafe { str::from_utf8_unchecked(&self.buf[begin..end]) }.parse::<T>();
                } else {
                    self.update_buf();
                }
            }
        }
        pub fn fast_i64(&mut self) -> i64 {
            loop {
                let mut begin = self.pos;
                while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                    begin += 1;
                }
                if begin == self.buf.len() {
                    self.update_buf();
                    continue;
                }
                let mut res = 0;
                let (is_positive, mut end) = match self.buf[begin] {
                    b'+' => (true, begin + 1),
                    b'-' => (false, begin + 1),
                    _ => (true, begin),
                };
                while end < self.buf.len() && (self.buf[end] > 0x20) {
                    res = res * 10 + (self.buf[end] as i64 - '0' as i64);
                    end += 1;
                }
                if begin != self.buf.len() {
                    self.pos = end;
                    return if is_positive { res } else { -res };
                } else {
                    self.update_buf();
                }
            }
        }
    }
}

mod eratosthenes {
    pub fn eratosthenes(n: usize) -> Vec<bool> {
        let n = n + 1;
        let mut res = vec![true; n];
        res[0] = false;
        res[1] = false;
        for i in 2.. {
            if i * i > n {
                break;
            }
            if res[i] {
                let mut k = i * i;
                while k < n {
                    res[k] = false;
                    k += i;
                }
            }
        }
        res
    }
}

use input_mcr::*;
use std::cmp::*;

use eratosthenes::*;

fn main() {
    input! {
        n: usize,
        xs: [i64; n],
    }
    let mut min = 1i64 << 50;
    let mut res = 0;
    for &x in &xs {
        if min > x {
            res += 1;
            min = x;
        }
    }
    println!("{}", res);
}


#![allow(unused_macros, deprecated)]

#[allow(dead_code)]
mod utils {
    use std::io::{
        self, BufRead, BufReader, BufWriter, Seek, SeekFrom, Stdin, StdinLock, Stdout, StdoutLock,
        Write,
    };
    use std::mem;
    use std::ops::{Deref, DerefMut};
    use std::ptr;
    use std::slice;
    use std::str::{self, FromStr};

    #[inline]
    fn is_space_or_line_break(b: &u8) -> bool {
        *b == b' ' || *b == b'\n'
    }

    pub struct Scanner<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> Scanner<R> {
        #[inline]
        pub fn new(reader: R) -> Scanner<R> {
            Scanner {
                reader: reader,
                buf: Vec::with_capacity(100),
            }
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_until(is_space_or_line_break);
            self.parse()
        }

        pub fn read2<T1: FromStr, T2: FromStr>(&mut self) -> (T1, T2) {
            (self.read(), self.read())
        }

        pub fn read3<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self) -> (T1, T2, T3) {
            (self.read(), self.read(), self.read())
        }

        pub fn read4<T1: FromStr, T2: FromStr, T3: FromStr, T4: FromStr>(
            &mut self,
        ) -> (T1, T2, T3, T4) {
            (self.read(), self.read(), self.read(), self.read())
        }

        pub fn reads(&mut self) -> &str {
            self.read_until(is_space_or_line_break);
            unsafe { str::from_utf8_unchecked(&self.buf) }
        }

        pub fn readl(&mut self) -> &str {
            self.buf.clear();
            self.reader.read_until(b'\n', &mut self.buf).unwrap();
            let bytes = if self.buf.last() == Some(&b'\n') {
                &self.buf[..self.buf.len() - 1]
            } else {
                &self.buf
            };
            unsafe { str::from_utf8_unchecked(&bytes) }
        }

        pub fn read_vec<T: FromStr>(&mut self, count: usize) -> Vec<T> {
            (0..count).map(|_| self.read()).collect()
        }

        fn read_until<P: FnMut(&u8) -> bool>(&mut self, mut predicate: P) {
            self.buf.clear();
            let mut first = true;

            // https://doc.rust-lang.org/src/std/io/mod.rs.html#1623-1649
            loop {
                let (done, used) = {
                    let available = self.reader.fill_buf().unwrap();
                    if first && available.len() == 0 {
                        panic!("Scan Error (EOF reached)");
                    }

                    match available.iter().position(&mut predicate) {
                        Some(0) if first => (false, 1),
                        Some(i) => {
                            self.buf.extend_from_slice(&available[..i]);
                            (true, i + 1)
                        }
                        None => {
                            self.buf.extend_from_slice(available);
                            (false, available.len())
                        }
                    }
                };

                self.reader.consume(used);
                if done || used == 0 {
                    return;
                }

                first = false;
            }
        }

        #[inline]
        fn parse<T: FromStr>(&mut self) -> T {
            // 文字列をT型へパースする
            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse()
                .unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }

    impl<R: BufRead + Seek> Seek for Scanner<R> {
        #[inline]
        fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
            self.reader.seek(pos)
        }
    }

    pub struct StdinScanner {
        stdin: Stdin,
        scanner: Scanner<BufReader<StdinLock<'static>>>,
    }

    impl StdinScanner {
        #[inline]
        pub fn new() -> StdinScanner {
            let stdin = io::stdin();
            let stdinlock = unsafe { mem::transmute(stdin.lock()) };
            let reader = BufReader::with_capacity(4096, stdinlock);
            let scanner = Scanner::new(reader);
            StdinScanner {
                stdin: stdin,
                scanner: scanner,
            }
        }
    }

    impl Deref for StdinScanner {
        type Target = Scanner<BufReader<StdinLock<'static>>>;

        #[inline]
        fn deref(&self) -> &Self::Target {
            &self.scanner
        }
    }

    impl DerefMut for StdinScanner {
        #[inline]
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.scanner
        }
    }

    pub struct StdoutWriter {
        stdout: Stdout,
        writer: BufWriter<StdoutLock<'static>>,
    }

    impl StdoutWriter {
        #[inline]
        pub fn new() -> StdoutWriter {
            let stdout = io::stdout();
            let stdoutlock = unsafe { mem::transmute(stdout.lock()) };
            let writer = BufWriter::with_capacity(4096, stdoutlock);
            StdoutWriter {
                stdout: stdout,
                writer: writer,
            }
        }

        pub fn write<T: Writable>(&mut self, v: T) {
            v.display(&mut self.writer);
        }

        pub fn writeln<T: Writable>(&mut self, v: T) {
            v.display(&mut self.writer);
            self.writer.write_all(b"\n").unwrap();
        }

        pub fn write_horizontal<I>(&mut self, iter: I)
        where
            I: IntoIterator,
            I::Item: Writable,
        {
            let mut it = iter.into_iter();
            if let Some(elem) = it.next() {
                elem.display(&mut self.writer);
            } else {
                return;
            }

            for elem in it {
                elem.display(&mut self.writer);
                self.writer.write_all(b" ").unwrap();
            }
        }

        pub fn write_vertical<I>(&mut self, iter: I)
        where
            I: IntoIterator,
            I::Item: Writable,
        {
            let mut it = iter.into_iter();
            if let Some(elem) = it.next() {
                elem.display(&mut self.writer);
            } else {
                return;
            }

            for elem in it {
                elem.display(&mut self.writer);
                self.writer.write_all(b"\n").unwrap();
            }
        }
    }

    impl Write for StdoutWriter {
        #[inline]
        fn flush(&mut self) -> io::Result<()> {
            self.writer.flush()
        }

        #[inline]
        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
            self.writer.write(buf)
        }
    }

    static DEC_DIGITS_LUT: &'static [u8; 200] = b"0001020304050607080910111213141516171819\
            2021222324252627282930313233343536373839\
            4041424344454647484950515253545556575859\
            6061626364656667686970717273747576777879\
            8081828384858687888990919293949596979899";

    fn write_int<W: Write>(mut writer: W, mut n: u64, is_negative: bool) {
        unsafe {
            let mut buf: [u8; 39] = mem::uninitialized();
            let buf_ptr_start = buf.as_mut_ptr().offset(39);
            let mut buf_ptr = buf_ptr_start;
            let lut_ptr = DEC_DIGITS_LUT.as_ptr();

            while n >= 10000 {
                let rem = (n % 10000) as isize;
                n /= 10000;

                let d1 = (rem / 100) << 1;
                let d2 = (rem % 100) << 1;
                buf_ptr = buf_ptr.offset(-4);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d2), buf_ptr.offset(2), 2);
            }

            let mut n = n as isize; // possibly reduce 64bit math

            // decode 2 more chars, if > 2 chars
            if n >= 100 {
                let d1 = (n % 100) << 1;
                n /= 100;
                buf_ptr = buf_ptr.offset(-2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
            }

            // decode last 1 or 2 chars
            if n < 10 {
                buf_ptr = buf_ptr.offset(-1);
                *buf_ptr = (n as u8) + b'0';
            } else {
                let d1 = n << 1;
                buf_ptr = buf_ptr.offset(-2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
            }

            if is_negative {
                buf_ptr = buf_ptr.offset(-1);
                *buf_ptr = b'-';
            }

            let buf_slice =
                slice::from_raw_parts(buf_ptr, buf_ptr_start as usize - buf_ptr as usize);

            writer.write_all(buf_slice).unwrap();
        }
    }

    pub trait Writable {
        fn display<W: Write>(&self, writer: &mut W);
    }

    impl Writable for str {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl<'a> Writable for &'a str {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl Writable for String {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl Writable for bool {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            let s: &'static [u8] = if *self { b"Yes" } else { b"No" };
            writer.write_all(s).unwrap();
        }
    }

    macro_rules! impl_writable_int {
        ($($int:ty)*) => {
            $(
                impl Writable for $int {
                    #[allow(unused_comparisons)]
                    fn display<W: Write>(&self, writer: &mut W) {
                        let is_negative = !(*self >= 0);
                        let abs = if is_negative {
                            (!*self as u64).wrapping_add(1)
                        } else {
                            *self as u64
                        };
                        write_int(writer, abs, is_negative);
                    }
                }
            )*
        };
    }

    macro_rules! impl_writable_float {
        ($($float:ty)*) => {
            $(
                impl Writable for $float {
                    #[inline]
                    fn display<W: Write>(&self, writer: &mut W) {
                        write!(writer, "{}", *self).unwrap();
                    }
                }
            )*
        }
    }

    impl_writable_int!(u8 u16 u32 u64 usize i8 i16 i32 i64 isize);
    impl_writable_float!(f32 f64);

    pub static mut SCANNER: *mut StdinScanner = 0 as *mut StdinScanner;
    pub static mut WRITER: *mut StdoutWriter = 0 as *mut StdoutWriter;

    #[inline]
    pub fn atcoder_initialize() {
        unsafe {
            SCANNER = mem::transmute(Box::new(StdinScanner::new()));
            WRITER = mem::transmute(Box::new(StdoutWriter::new()));
        }
    }

    #[inline]
    pub fn atcoder_finish() {
        unsafe {
            (*WRITER).flush().unwrap();
        }
    }
}

macro_rules! input {
    () => {};
    (@scanner $scanner:ident, @pred [ $($pred:tt)* ], ($var1:tt, $var2:tt) : [($t1:tt, $t2:tt) ; $len:expr]) => {
        let mut $var1 = Vec::with_capacity($len as usize);
        let mut $var2 = Vec::with_capacity($len as usize);

        for _ in 0..$len {
            $var1.push(scan!($scanner, $t1));
            $var2.push(scan!($scanner, $t2));
        }
    };
    (@scanner $scanner:ident, @pred [ $($pred:tt)* ], $var:tt : $t:tt) => {
        let $($pred)* $var = scan!($scanner, $t);
    };
    (@scanner $scanner:ident,) => {};
    (@scanner $scanner:ident, $var:tt : $t:tt) => {
        input!(@scanner $scanner, @pred [], $var : $t);
    };
    (@scanner $scanner:ident, mut $var:tt : $t:tt) => {
        input!(@scanner $scanner, @pred [mut], $var : $t);
    };
    (@scanner $scanner:ident, $var:tt : $t:tt, $($r:tt)*) => {
        input!(@scanner $scanner, $var : $t);
        input!(@scanner $scanner, $($r)*);
    };
    (@scanner $scanner:ident, mut $var:tt : $t:tt, $($r:tt)*) => {
        input!(@scanner $scanner, mut $var : $t);
        input!(@scanner $scanner, $($r)*);
    };
    ($($r:tt)*) => {
        let scanner_ref = unsafe { &mut *$crate::utils::SCANNER };
        input!(@scanner scanner_ref, $($r)*);
    }
}

macro_rules! scan {
    ($scanner:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| scan!($scanner, $t)).collect::<Vec<_>>()
    };
    ($scanner:ident, usize1) => {
        scan!($scanner, usize) - 1
    };
    ($scanner:ident, line) => {
        $scanner.readl().to_string()
    };
    ($scanner:ident, $t:ty) => {
        $scanner.read::<$t>()
    };
}

macro_rules! pprint {
    ($value:expr) => {
        unsafe {
            (*$crate::utils::WRITER).write($value);
        }
    };
    ($value:expr, $($r:tt)*) => {
        let writer = unsafe { &*$crate::utils::WRITER };
        writer.write($value);
        writer.write(" ");
        pprint!($($r)*);
    };
}

macro_rules! pprintln {
    ($value:expr) => {
        unsafe {
            (*$crate::utils::WRITER).writeln($value);
        }
    };
    ($value:expr, $($r:tt)*) => {
        let writer = unsafe { &*$crate::utils::WRITER };
        writer.write($value);
        writer.write(" ");
        pprintln!($($r)*);
    };
}

macro_rules! atcoder_main {
    ($func:ident) => {
        fn main() {
            $crate::utils::atcoder_initialize();
            $func();
            $crate::utils::atcoder_finish();
        }
    };
}

fn run() {
    input! {
        n: usize,
        p: [u32; n]
    }

    let mut count = 0;
    let mut min = u32::max_value();

    for pi in p {
        if pi <= min {
            count += 1;
            min = pi;
        }
    }

    pprintln!(count);
}

atcoder_main!(run);


fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    use std::cmp::min;

    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut pv = vec![0u32; n];
    for i in 0..n - 1 {
        pv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    pv[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = 0;
    let mut mp = pv[0];
    for i in 0..pv.len() {
        if pv[i] <= mp {
            ans += 1;
        }
        mp = min(mp, pv[i]);
    }

    println!("{}", ans);
}


use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let p: Vec<usize> = parse_line().unwrap();
    let mut cnt = 0;

    for i in 0..n {
        let mut ans = true;
        for k in 0..=i {
            if p[k] < p[i] {
                ans = false;
                break;
            }
        }
        if ans {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, p: [usize; n]};

    let mut count = 1;
    let mut min = p[0];

    for i in 1..n - 1 {
        if min >= p[i] {
            count += 1;
            min = p[i];
        }
    }

    println!("{}", count)
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, p: [usize; n]};
    let p: Vec<usize> = p;

    let mut count = 1;
    let mut index = 0;

    for i in 1..n {
        if index == i - 1 {
            if p[index] >= p[i] {
                count += 1;
                index += 1;
            }
        } else {
            let m = &p[index..i - 1];
            if *m.iter().min().unwrap() >= p[i] {
                index = i;
                count += 1;
            }
        }
    }

    println!("{}", count)
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func main() {
    let n = readInt()
    let aryP = readInts()
    //_________________________ここまで入力

    /// 最小値
    var m = Int.max
    var ans = 0
    for i in 0..<n {
        if aryP[i] <= m {
            m = aryP[i]
            ans += 1
        }
    }
    print(ans)
}

main()


let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var ans = 1
var m = arr[0]

for i in 1..<n {
  if (m > arr[i]) {
    ans += 1
  }
  m = min(arr[i], m)
}

print(ans)


let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var ans = 1

for i in 1..<n {
  var j = 0
  var m = i
  var found = true

  for j in 0...m {
    if( arr[j] < arr[i] ) {
      found = false
      break
    }
  }

  if (found) {
    ans += 1
  }
}

print(ans)


import * as fs from 'fs'

//in
// 5
// 4 2 5 1 3
//out
// 3
const input: string[] = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
const n: number = parseInt(input[0]);
const p: number[] = input[1].split(' ').map(Number);
let result: number = 0;
let min :number = Infinity;
for (let i: number = 0; i < n; i++) {

    if (min > p[i]) {
        result++;
        min = p[i];
    }
}

console.log(result);


{
  const main = (
    input: string
  ): void | string | number | string[] | number[] => {
    const r = _reader(input)
    const [N] = r.nn()
    const P = r.nn()

    let min = P[0]
    let sum = 1

    for (let i = 1; i < N; i++) {
      if (min > P[i]) {
        sum += 1
        min = P[i]
      }
    }

    return sum
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
  if (typeof _res === 'object') console.log(_res.join(' '))
}


function Main(input) {
    const lines = input.split("\n");
    const ps = lines[1].split(' ').map(v => +v);
    let count = 0;
  	let min = ps[0];

    for (let i = 0; i < ps.length; i++) {
      if (ps[i] <= min) {
        count++;
        min = ps[i];
      }
    }

    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


import * as fs from 'fs'

//in
// 5
// 4 2 5 1 3
//out
// 3
const input: string[] = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
const n: number = parseInt(input[0]);
const p: number[] = input[1].split(' ').map(args => parseInt(args));
let result: number = 0;
for (let i: number = 0; i < n; i++) {
    for (let j: number = 0; j <= i; j++) {
        if (p[i] > p[j]) {
            break;
        }
        if (j === i) {
            result += 1;
        }
    }
}

console.log(result);


import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);

const n = +input[0];

let count = 0;

input.slice(1, n + 1).map((i, index) => {
  const j: number[] = input.slice(1, index + 2).map(val => +val);
  if (+i <= Math.min(...j)) {
    count++;
  }
});

console.log(count);


import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);

const n = +input[0];

let count = 0;

input.slice(0, n + 1).map((i, index) => {
  const j = input.slice(1, index + 1);
  j.sort();
  if (+i <= +j[0]) {
    count++;
  }
});

console.log(count);


n,m=map(int,input().split())
num=[-1]*n
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0 and n!=1:print(-1);exit()
    if num[s-1]==-1:
        num[s-1]=c
    if num[s-1]!=-1:
        if num[s-1]!=c:print(-1);exit()
if n==1 and num[0]==-1:print(0)
else:
    ans=0
    for i in range(n):
        if num[i]!=-1:
            ans+=num[i]*10**(n-i-1)
        elif i==0:ans+=10**(n-1)
        else:continue
    print(ans)


n, m = map(int, input().split())

flag = False

used = []
d = [0]*n
for _ in range(m):
    s, c = map(int, input().split())
    if n > 1 and (s == 1 and c == 0):
        flag = True
    if (s in used) and d[s-1] != c:
        flag = True
    else:
        d[s-1] = c
        used.append(s)

if flag:
    print(-1)
else:
    if n != 1 and d[0] == 0:
        d[0] = 1
    print(''.join(map(str, d)))


n, m = [int(i) for i in input().split()]
sc = list(set([tuple(map(int, input().split())) for _ in range(m)]))

s = list('x'*n)
for i in range(len(sc)):
    if s[sc[i][0]-1] != 'x':
        print("-1")
        exit()
    s[sc[i][0]-1] = str(sc[i][1])

if n > 1 and s[0] == 'x':
    s[0] = '1'

ans = int("".join(s).replace('x', '0'))
print(ans if len(str(ans)) == n else -1)


n, m = map(int, input().split())
num = [None] * n
a = [tuple(map(int, input().split())) for _ in range(m)]
for pos, val in a:
    if num[pos - 1] != None and num[pos - 1] != val:
        print(-1)
        exit()
    num[pos - 1] = val
if n == 1:
    print(0)
    exit()
canBeZero = False
for i in range(n):
    if num[i] == None:
        num[i] = 0 if canBeZero else 1
    if num[i]:
        canBeZero = True
ret = str(int(''.join(map(str, num))))
print(ret if len(ret) == n else -1)


n, m = map(int, input().split())
num = [None] * n
a = [tuple(map(int, input().split())) for _ in range(m)]
for pos, val in a:
    if num[pos - 1] != None and num[pos - 1] != val:
        print(-1)
        exit()
    num[pos - 1] = val
canBeZero = False
for i in range(n):
    if num[i] == None:
        num[i] = 0 if canBeZero else 1
    if num[i]:
        canBeZero = True
ret = str(int(''.join(map(str, num))))
print(ret if len(ret) == n else -1)


n, m= map(int, input().split())
ans = [10] * (n + 1)
#s-digit: ans = [dummy, 1st-d, 2nd-d, ...]
for i in range(m):
  s, c = map(int, input().split())
  if ans[s] == 10 and not (s==1 and c==0):
    ans[s] = c
  elif ans[s] == c:
    pass
  elif ans[s] != c or (s==1 and c==0):
    print(-1)
    exit()
for i in range(1, n+1):
  if ans[i] == 10:
    ans[i] = 0
    if i == 1:
      ans[i] += 1
print(''.join([str(x) for x in ans[1:]]))