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 java.io.*;
import java.util.*;

public class hack{

  public static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String [] nextArray(){
            StringTokenizer tokens = new StringTokenizer(nextLine(), " ");
            String[] splited = new String[tokens.countTokens()];
            int index = 0;
            while(tokens.hasMoreTokens()){
              splited[index] = tokens.nextToken();
              if(splited[index]!="")
                ++index;
            }
            return splited;
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
  }
/*  public static void solve(String t,String e,StringBuilder sb){
      BigInteger total=new BigInteger(t);
      BigInteger extra=new BigInteger(e);
      BigInteger ans=total.subtract(extra);
      ans=ans.divide(new BigInteger("2"));
      BigInteger ans2=ans.add(extra);
      sb.append(ans2+"\n"+ans+"\n");
  }
    static 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;
    LinkedList<Integer>[] adjListArray;

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

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

        for(int i = 1; i <= V ; i++){
            adjListArray[i] = new LinkedList<Integer>();
        }
    }

    // Adds an edge to an undirected graph
    void addEdge( int src, int dest) {
        // Add an edge from src to dest.
        adjListArray[src].add(dest);

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

    int DFSUtil(int v,boolean visited[])
    {
        // Mark the current node as visited and print it
        int c=0;
        visited[v] = true;
        c=1;
        //System.out.print(v+" ");

        // Recur for all the vertices adjacent to this vertex
        Iterator<Integer> i = adjListArray[v].listIterator();
        while (i.hasNext())
        {
            int n = i.next();
            if (!visited[n])
                c=c+DFSUtil(n, visited);
        }
        return c;
    }

    // The function to do DFS traversal. It uses recursive DFSUtil()
    int DFS(int v)
    {
        int c=0;
        // Mark all the vertices as not visited(set as
        // false by default in java)
        boolean visited[] = new boolean[V];

        // Call the recursive helper function to print DFS traversal
        c=DFSUtil(v, visited);
        return c;
    }
  }*/

  static void sieveOfEratosthenes(boolean prime[],long sum[])
  {
      // Create a boolean array "prime[0..n]" and initialize
      // all entries it as false. A value in prime[i] will
      // be true if i is Not a prime, else false.
      int n=prime.length-1,p;
      for(p = 2; p*p <=n; p++)
      {
          // If prime[p] is not changed, then it is a prime
          if(prime[p] == false)
          {
              // Update all multiples of p
              for(int i = p*p; i <= n; i += p)
                  prime[i] = true;
          }
          sum[p]=sum[p-1];
          if(prime[p]==false)
            sum[p]+=p;
      }
      for(;p<=n;p++){
        sum[p]=sum[p-1];
        if(prime[p]==false)
          sum[p]+=p;
      }

      // Print all prime numbers
  }
    public static void main (String args[]) throws IOException{
       //Reader in = new Reader();
       FastReader in=new FastReader();
       BufferedOutputStream out=new BufferedOutputStream(System.out);
       StringBuilder sb = new StringBuilder();

       int n=in.nextInt(),i;
       int[]a=new int[n+1];
       int max=0,count=0;
       for(i=1;i<=n;i++){
         a[i]=in.nextInt();
       }
       max=a[1];
       for(i=1;i<=n;){
         max=a[i];
         //System.out.println("      "+count);
         for(;i<=max;i++){
           if(a[i]>max)
            max=a[i];
           //System.out.println(max+" ????   "+i);
         }
         count++;

       }
       sb.append(count+"\n");
       out.write(sb.toString().getBytes());
       out.flush();
    }


}
