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.*;
  import java.util.*;
  
  public class A {
  
      public static void print(int[] arr) {
          //for debugging only
          for (int x : arr)
              System.out.print(x + " ");
          System.out.println();
      }
  
      public static boolean isPrime(long n) {
          if (n < 2) return false;
          if (n == 2 || n == 3) return true;
          if (n % 2 == 0 || n % 3 == 0) return false;
          long sqrtN = (long) Math.sqrt(n) + 1;
          for (long i = 6L; i <= sqrtN; i += 6) {
              if (n % (i - 1) == 0 || n % (i + 1) == 0) return false;
          }
          return true;
      }
  
      public static long gcd(long a, long b) {
          if (a > b)
              a = (a + b) - (b = a);
          if (a == 0L)
              return b;
          return gcd(b % a, a);
      }
  
      public static ArrayList<Integer> findDiv(int N) {
          //gens all divisors of N
          ArrayList<Integer> ls1 = new ArrayList<Integer>();
          ArrayList<Integer> ls2 = new ArrayList<Integer>();
          for (int i = 1; i <= (int) (Math.sqrt(N) + 0.00000001); i++)
              if (N % i == 0) {
                  ls1.add(i);
                  ls2.add(N / i);
              }
          Collections.reverse(ls2);
          for (int b : ls2)
              if (b != ls1.get(ls1.size() - 1))
                  ls1.add(b);
          return ls1;
      }
  
      public static void sort(int[] arr) {
          //because Arrays.sort() uses quicksort which is dumb
          //Collections.sort() uses merge sort
          ArrayList<Integer> ls = new ArrayList<Integer>();
          for (int x : arr)
              ls.add(x);
          Collections.sort(ls);
  
          for (int i = 0; i < arr.length; i++)
              arr[i] = ls.get(i);
      }
  
      public static long power(long x, long y, long p) {
          //0^0 = 1
          //Modular Exponentiation (Power in Modular Arithmetic)
          // O(logy)
          long res = 1L;
          x = x % p;
          while (y > 0) {
              if ((y & 1) == 1)
                  res = (res * x) % p;
              y >>= 1;
              x = (x * x) % p;
          }
          return res;
      }
  
      public static void main(String hi[]) throws Exception {
          FastScanner scn = new FastScanner();
          //Write from here
          int t=scn.nextInt();
          while(t-->0)
          {
              int n=scn.nextInt();
              long[] arr=scn.nextLongs(n);
              long max=Integer.MIN_VALUE;
              long res=0;
              for (int i = 0; i < arr.length; i++) {
                  int idx=i+1;
                  if(arr[i]>idx)
                  {
                      res=arr[i]-idx;
                      if(max<res)
                      {
                          max=res;
                      }
                  }
              }
              if(max==Integer.MIN_VALUE)
                  max=0;
              System.out.println(max);
          }
      }
  
  }
  
  
  class FastScanner {
  
      //I don't understand how this works lmao
      private int BS = 1 << 16;
      private char NC = (char) 0;
      private byte[] buf = new byte[BS];
      private int bId = 0, size = 0;
      private char c = NC;
      private double cnt = 1;
      private BufferedInputStream in;
  
      public FastScanner() {
          in = new BufferedInputStream(System.in, BS);
      }
  
      public FastScanner(String s) {
          try {
              in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
          } catch (Exception e) {
              in = new BufferedInputStream(System.in, BS);
          }
      }
  
      private char getChar() {
          while (bId == size) {
              try {
                  size = in.read(buf);
              } catch (Exception e) {
                  return NC;
              }
              if (size == -1) return NC;
              bId = 0;
          }
          return (char) buf[bId++];
      }
  
      public int nextInt() {
          //returns Int
          return (int) nextLong();
      }
  
      public int[] nextInts(int N) {
          //returns array of integers of size N
          int[] res = new int[N];
          for (int i = 0; i < N; i++) {
              res[i] = (int) nextLong();
          }
          return res;
      }
  
      public long[] nextLongs(int N) {
          //returns array of Longs of size N
          long[] res = new long[N];
          for (int i = 0; i < N; i++) {
              res[i] = nextLong();
          }
          return res;
      }
  
      public long nextLong() {
          //return long
          cnt = 1;
          boolean neg = false;
          if (c == NC) c = getChar();
          for (; (c < '0' || c > '9'); c = getChar()) {
              if (c == '-') neg = true;
          }
          long res = 0;
          for (; c >= '0' && c <= '9'; c = getChar()) {
              res = (res << 3) + (res << 1) + c - '0';
              cnt *= 10;
          }
          return neg ? -res : res;
      }
  
      public double nextDouble() {
          //return double
          double cur = nextLong();
          return c != '.' ? cur : cur + nextLong() / cnt;
      }
  
      public double[] nextDoubles(int N) {
          //return array of doubles
          double[] res = new double[N];
          for (int i = 0; i < N; i++) {
              res[i] = nextDouble();
          }
          return res;
      }
  
      public String next() {
          StringBuilder res = new StringBuilder();
          while (c <= 32) c = getChar();
          while (c > 32) {
              res.append(c);
              c = getChar();
          }
          return res.toString();
      }
  
      public String nextLine() {
          StringBuilder res = new StringBuilder();
          while (c <= 32) c = getChar();
          while (c != '\n') {
              res.append(c);
              c = getChar();
          }
          return res.toString();
      }
  
      public boolean hasNext() {
          if (c > 32) return true;
          while (true) {
              c = getChar();
              if (c == NC) return false;
              else if (c > 32) return true;
          }
      }
  }
  