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.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;

public class AA {
	static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		InputReader scan = new InputReader(new BufferedInputStream(System.in));
		int n = scan.nextInt(), ans = 0, mystery = -1, index = 1;
		for (int i=0;i<n;i++) {
			int a = scan.nextInt();
			mystery = Math.max(a, mystery);
			if (mystery==i+1)
				ans++;
		}
		System.out.println(ans);
		scan.close();
	}

	private static long pow(int base, int exponent) {
		if (base == 1)
			return 1l;
		if (exponent == 1)
			return (long) base;
		if (exponent == 0)
			return 1l;
		if (exponent % 2 == 0) {
			long ans = pow(base, exponent / 2);
			return Math.floorMod((ans * ans), MOD);
		}
		return Math.floorMod(((long) base * (long) pow(base, exponent - 1)), MOD);
		/*
		 * long result = 1; base = base % MOD; while (exponent > 0) { if (exponent % 2
		 * == 1) { result = result * base; result %= MOD; } exponent = exponent / 2;
		 * base = (base * base) % MOD; } return result;
		 */
	}

	static class UF {

		private int[] parent; // parent[i] = parent of i
		private byte[] rank; // rank[i] = rank of subtree rooted at i (never more than 31)
		private int count; // number of components

		public UF(int n) {
			if (n < 0)
				throw new IllegalArgumentException();
			count = n;
			parent = new int[n];
			rank = new byte[n];
			for (int i = 0; i < n; i++) {
				parent[i] = i;
				rank[i] = 0;
			}
		}

		public Map<Integer, Integer> getCounts() {
			Map<Integer, Integer> map = new HashMap<>(count);
			for (int i : parent)
				map.put(i, 1 + map.getOrDefault(i, 0));
			return map;
		}

		public void print() {
			System.out.println(Arrays.toString(parent));
			System.out.println(Arrays.toString(rank));
		}

		public int find(int p) {
			while (p != parent[p]) {
				parent[p] = parent[parent[p]]; // path compression by halving
				p = parent[p];
			}
			return p;
		}

		public int count() {
			return count;
		}

		public boolean connected(int p, int q) {
			return find(p) == find(q);
		}

		public void union(int p, int q) {
			int rootP = find(p);
			int rootQ = find(q);
			if (rootP == rootQ)
				return;
			// make root of smaller rank point to root of larger rank
			if (rank[rootP] < rank[rootQ])
				parent[rootP] = rootQ;
			else if (rank[rootP] > rank[rootQ])
				parent[rootQ] = rootP;
			else {
				parent[rootQ] = rootP;

				rank[rootP]++;
			}
			count--;
		}
	}

	static class InputReader {

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

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

		public void close() throws IOException {
			this.stream.close();
		}

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

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public boolean isSpaceChar(int c) {
			if (filter != null) {
				return filter.isSpaceChar(c);
			}
			return isWhitespace(c);
		}

		public interface SpaceCharFilter {

			public boolean isSpaceChar(int ch);
		}

		public String next() {
			return nextString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public Long nextLong() {
			return Long.parseLong(nextString());
		}

		public Double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public char nextCharacter() {
			return nextString().charAt(0);
		}

		public int[] nextIntArray(int N) {
			int A[] = new int[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextInt();
			}
			return A;
		}

		public long[] nextLongArray(int N) {
			long A[] = new long[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextLong();
			}
			return A;
		}

		public double[] nextDoubleArray(int N) {
			double A[] = new double[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextDouble();
			}
			return A;
		}
	}

	int min(int... a) {
		int min = Integer.MAX_VALUE;
		for (int v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	long min(long... a) {
		long min = Long.MAX_VALUE;
		for (long v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	double min(double... a) {
		double min = Double.MAX_VALUE;
		for (double v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	int max(int... a) {
		int max = Integer.MIN_VALUE;
		for (int v : a) {
			max = Math.max(max, v);
		}
		return max;
	}

	long max(long... a) {
		long max = Long.MIN_VALUE;
		for (long v : a) {
			max = Math.max(max, v);
		}
		return max;
	}

	double max(double... a) {
		double max = Double.MIN_VALUE;
		for (double v : a) {
			max = Math.max(max, v);
		}
		return max;
	}
}