Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i ≥ i).

Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.

How many days will it take to read the whole book?

Input

The first line contains single integer n (1 ≤ n ≤ 10^4) — the number of pages in the book.

The second line contains n integers a_1, a_2, ..., a_n (i ≤ a_i ≤ n), where a_i is the number of page which contains the explanation of the mystery on page i.

Output

Print one integer — the number of days it will take to read the whole book.

Example

Input


9
1 3 3 6 7 6 8 8 9


Output


4

Note

Explanation of the example test:

During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day — pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import java.io.*;
import java.math.*;
import java.util.*;


// author @mdazmat9
public class codeforces{


    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int test = 1;
        for (int ind = 0; ind < test; ind++) {
            int n=sc.nextInt();
            int [] a=new int[n];
            for(int i=0;i<n;i++)
                a[i]=sc.nextInt();
            int l=a[0];int max=a[0];int count=0,ini=0;int check=0;
            while (true) {

                int tem_max = 0;
                int temp = 0;
                for (int i = ini; i <= l - 1; i++) {

                    temp++;
                    if (a[i] > tem_max)
                        tem_max = a[i];
                }


                ini += temp;

                if (ini >= n) {
                    break;
                }
                if (tem_max <= max) {
                    count++;
                    l = a[ini];
                } else {
                    l = tem_max;

                }

            }
            out.println(count+1);


        }
        out.flush();
    }
    static long fast_pow(long a, long b) {
        if(b == 0)
            return 1L;

        long val = fast_pow(a, b / 2);

        if(b % 2 == 0)
            return val * val % mod;
        else
            return val * val % mod * a % mod;
    }
    static long mod = (long)1e9 + 7;
    static   void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    static long gcd(long a , long b)
    {
        if(b == 0)
            return a;
        return gcd(b , a % b);
    }

}
class Scanner {
    public BufferedReader reader;
    public StringTokenizer st;

    public Scanner(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        st = null;
    }

    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

class OutputWriter {
    BufferedWriter writer;

    public OutputWriter(OutputStream stream) {
        writer = new BufferedWriter(new OutputStreamWriter(stream));
    }

    public void print(int i) throws IOException {
        writer.write(i);
    }

    public void print(String s) throws IOException {
        writer.write(s);
    }

    public void print(char[] c) throws IOException {
        writer.write(c);
    }

    public void close() throws IOException {
        writer.close();
    }

}
class Pair {
    int x;
    int y;

    // Constructor
    public Pair(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
}
class Compare {

    static void compare(Pair arr[], int n)
    {
        // Comparator to sort the pair according to second element
        Arrays.sort(arr, new Comparator<Pair>() {
            @Override public int compare(Pair p1, Pair p2)
            {
                return p1.x - p2.x;
            }
        });
    }
}

class Graph {
    // A user define class to represent a graph.
    // A graph is an array of adjacency lists.
    // Size of array will be V (number of vertices
    // in graph)
    int V;
    ArrayList<Integer>[] adjListArray;

    // constructor
    Graph(int V) {
        this.V = V;
        // define the size of array as
        // number of vertices
        adjListArray = new ArrayList[V];

        // Create a new list for each vertex
        // such that adjacent nodes can be stored

        for (int i = 0; i < V; i++) {
            adjListArray[i] = new ArrayList<>();
        }
    }

    // Adds an edge to an undirected graph
    void addEdge(int src, int dest) {

        // Add an edge from src to dest.
        //src--;dest--; //do this for 1 based indexing

        //
        adjListArray[src].add(dest);

        // Since graph is undirected, add an edge from dest
        // to src also
        adjListArray[dest].add(src);
    }


    Boolean DFSUtil(int u, boolean visited[], int parent,ArrayList<Integer> list)
    {
        // Mark the current node as visited
        visited[u] = true;

        for (int i = 0; i < adjListArray[u].size(); i++) {
            int n = adjListArray[u].get(i);
            list.add(n);
            if (!visited[i]) {
                if (DFSUtil(n, visited, u,list))
                    return true;
            }
            else if (i != parent) {
                System.out.println(list);
                list=new ArrayList<>();
            }
        }
        return false;
    }


    // The function to do DFS traversal. It uses recursive DFSUtil()
    void DFS() {
        // Mark all the vertices as not visited(set as
        // false by default in java)
        boolean visited[] = new boolean[V];
       ArrayList<Integer> list=new ArrayList<>();
        // Call the recursive helper function to print DFS traversal
        boolean bool=true;
        for (int i = 0; i < V; ++i) {
            if (!visited[i]) {
                if (DFSUtil(i, visited, -1,list)) {
                    System.out.println("Cycle");
                    bool=false;
                    break;
                }
            }
        }
        if(bool)
        System.out.println("Not cycle");

    }
    boolean BFS()
    {
        int s=0;      //if 0 based indexing
        // Mark all the vertices as not visited(By default
        // set as false)
        boolean visited[] = new boolean[V];
        int parent[] = new int[V];
        Arrays.fill(parent, -1);

        // Create a queue for BFS
        Queue<Integer> queue = new LinkedList<>();
        //    LinkedList<Integer> queue = new LinkedList<>();

        // Mark the current node as visited and enqueue it
        visited[s]=true;
        queue.add(s);

        while (queue.size() != 0)
        {
            // Dequeue a vertex from queue and print it
            s = queue.poll();
            System.out.print(s+" ");

            // Get all adjacent vertices of the dequeued vertex s
            // If a adjacent has not been visited, then mark it
            // visited and enqueue it
            for(int i=0;i<adjListArray[s].size();i++){
                int n = adjListArray[s].get(i);
                if (!visited[n])
                {
                    visited[n] = true;
                    queue.add(n);
                    parent[n]=s;
                }
                else if (parent[n] != s)
                    return true;


            }
            }
            return false;
        }
    }
