import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] rs = new int[n]; for(int i = 0 ; i < n - 1 ; i++){ rs[i] = sc.nextInt(); } rs[n-1] = n; int now = 1; int ans = 0; while(rs[now-1] != n){ int max = -1; for(int i = now, len = rs[now-1] ; i < len ; i++){ max = Math.max(max , rs[i-1]); } now = max; ans++; } System.out.println(ans+1); } }