description: Shohag has an integer sequence a_1, a_2, …, a_n. He can perform the following operation any number of times (possibly, zero):
  
    * Select any positive integer k (it can be different in different operations). 
    * Choose any position in the sequence (possibly the beginning or end of the sequence, or in between any two elements) and insert k into the sequence at this position. 
    * This way, the sequence a changes, and the next operation is performed on this changed sequence. 
  
  
  
  For example, if a=[3,3,4] and he selects k = 2, then after the operation he can obtain one of the sequences [\underline{2},3,3,4], [3,\underline{2},3,4], [3,3,\underline{2},4], or [3,3,4,\underline{2}].
  
  Shohag wants this sequence to satisfy the following condition: for each 1 ≤ i ≤ |a|, a_i ≤ i. Here, |a| denotes the size of a.
  
  Help him to find the minimum number of operations that he has to perform to achieve this goal. We can show that under the constraints of the problem it's always possible to achieve this goal in a finite number of operations.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 200) — the number of test cases.
  
  The first line of each test case contains a single integer n (1 ≤ n ≤ 100) — the initial length of the sequence.
  
  The second line of each test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9) — the elements of the sequence.
  
  Output
  
  For each test case, print a single integer — the minimum number of operations needed to perform to achieve the goal mentioned in the statement.
  
  Example
  
  Input
  
  
  4
  3
  1 3 4
  5
  1 2 5 7 4
  1
  1
  3
  69 6969 696969
  
  
  Output
  
  
  1
  3
  0
  696966
  
  Note
  
  In the first test case, we have to perform at least one operation, as a_2=3>2. We can perform the operation [1, 3, 4] → [1, \underline{2}, 3, 4] (the newly inserted element is underlined), now the condition is satisfied.
  
  In the second test case, Shohag can perform the following operations:
  
  [1, 2, 5, 7, 4] → [1, 2, \underline{3}, 5, 7, 4] → [1, 2, 3, \underline{4}, 5, 7, 4] → [1, 2, 3, 4, 5, \underline{3}, 7, 4].
  
  In the third test case, the sequence already satisfies the condition.
solution: import java.io.BufferedReader;
  import java.util.*;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.math.BigInteger;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Map;
  import java.util.PriorityQueue;
  import java.util.Random;
  import java.util.Set;
  import java.util.StringTokenizer;
  
  public class C {
  
  	public static void main(String[] args) throws IOException {
  
  		FastScanner sc = new FastScanner();
  		PrintWriter out = new PrintWriter(System.out);
  int t=sc.nextInt();
  
  while(t--!=0) {
  int n=sc.nextInt();
  int arr[]=sc.readArray(n);
  boolean flag=false;
  int max=0;
  for(int i=n;i>=1;i--) {
  	if(i<arr[i-1]) {
  		max=Math.max(arr[i-1]-i,max);
  		flag=true;
  	}
  }
  if(flag==false) {
  	System.out.println(0);
  }
  else {
  	System.out.println(max);
  }
  }}
  	
  				
  	
  	
  
  	static void ruffleSort(int[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			int temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  		Arrays.sort(a);
  	}
  
  	static void ruffleSort(long[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			long temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  		Arrays.sort(a);
  	}
  
  	static class Pair implements Comparable<Pair> {
  		int x, y;
  
  		Pair(int x, int y) {
  			this.x = x;
  			this.y = y;
  		}
  
  		@Override
  		public int compareTo(Pair o) {
  			return Integer.compare(this.x, o.x);
  		}
  
  	}
  
  	static class FastScanner {
  		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  		StringTokenizer st = new StringTokenizer("");
  
  		String next() {
  			while (!st.hasMoreTokens())
  				try {
  					st = new StringTokenizer(br.readLine());
  				} catch (IOException e) {
  					e.printStackTrace();
  				}
  			return st.nextToken();
  		}
  
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  
  		int[] readArray(int n) {
  			int[] a = new int[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextInt();
  			return a;
  		}
  
  		long[] readArrayLong(int n) {
  			long[] a = new long[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextInt();
  			return a;
  		}
  
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  
  		String nextLine() {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			return str;
  		}
  	}
  
  	static int ceil(int x, int y) {
  		return (x % y == 0 ? x / y : (x / y + 1));
  	}
  
  	static long ceil(long x, long y) {
  		return (x % y == 0 ? x / y : (x / y + 1));
  	}
  
  	static int max(int x, int y) {
  		return Math.max(x, y);
  	}
  
  	static int min(int x, int y) {
  		return Math.min(x, y);
  	}
  
  	static long max(long x, long y) {
  		return Math.max(x, y);
  	}
  
  	static long min(long x, long y) {
  		return Math.min(x, y);
  	}
  
  	static int min(int a[]) {
  		int x = 1_000_000_00_9;
  		for (int i = 0; i < a.length; i++)
  			x = min(x, a[i]);
  		return x;
  	}
  
  	static int max(int a[]) {
  		int x = -1_000_000_00_9;
  		for (int i = 0; i < a.length; i++)
  			x = max(x, a[i]);
  		return x;
  	}
  
  	static long min(long a[]) {
  		long x = (long) 3e18;
  		for (int i = 0; i < a.length; i++)
  			x = min(x, a[i]);
  		return x;
  	}
  
  	static long max(long a[]) {
  		long x = -(long) 3e18;
  		for (int i = 0; i < a.length; i++)
  			x = max(x, a[i]);
  		return x;
  	}
  
  	static int power(int x, int y) {
  		int res = 1;
  		while (y > 0) {
  			if (y % 2 == 1)
  				res = (res * x);
  			y >>= 1;
  			x = (x * x);
  		}
  		return res;
  	}
  
  	static long power(long x, long y) {
  		long res = 1;
  		while (y > 0) {
  			if (y % 2 == 1)
  				res = (res * x);
  			y >>= 1;
  			x = (x * x);
  		}
  		return res;
  	}
  
  	static void intsort(int[] a) {
  		List<Integer> temp = new ArrayList<Integer>();
  		for (int i = 0; i < a.length; i++)
  			temp.add(a[i]);
  		Collections.sort(temp);
  		for (int i = 0; i < a.length; i++)
  			a[i] = temp.get(i);
  	}
  
  	static void longsort(long[] a) {
  		List<Long> temp = new ArrayList<Long>();
  		for (int i = 0; i < a.length; i++)
  			temp.add(a[i]);
  		Collections.sort(temp);
  		for (int i = 0; i < a.length; i++)
  			a[i] = temp.get(i);
  	}
  
  	static void reverseintsort(int[] a) {
  		List<Integer> temp = new ArrayList<Integer>();
  		for (int i = 0; i < a.length; i++)
  			temp.add(a[i]);
  		Collections.sort(temp);
  		Collections.reverseOrder();
  		for (int i = 0; i < a.length; i++)
  			a[i] = temp.get(i);
  	}
  
  	static void reverselongsort(long[] a) {
  		List<Long> temp = new ArrayList<Long>();
  		for (int i = 0; i < a.length; i++)
  			temp.add(a[i]);
  		Collections.sort(temp);
  		Collections.reverseOrder();
  		for (int i = 0; i < a.length; i++)
  			a[i] = temp.get(i);
  	}
  
  	static class longpair implements Comparable<longpair> {
  		long x, y;
  
  		longpair(long x, long y) {
  			this.x = x;
  			this.y = y;
  		}
  
  		public int compareTo(longpair p) {
  			return Long.compare(this.x, p.x);
  		}
  	}
  
  	public static int gcd(int a, int b) {
  		BigInteger b1 = BigInteger.valueOf(a);
  		BigInteger b2 = BigInteger.valueOf(b);
  		BigInteger gcd = b1.gcd(b2);
  		return gcd.intValue();
  	}
  
  	public static long gcd(long a, long b) {
  		BigInteger b1 = BigInteger.valueOf(a);
  		BigInteger b2 = BigInteger.valueOf(b);
  		BigInteger gcd = b1.gcd(b2);
  		return gcd.longValue();
  	}
  }
  
  
  