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: //package com.company;
  
  import java.io.*;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Main {
  
      static boolean[] primecheck = new boolean[1000002];
  
      public static void main(String[] args) throws IOException {
          OutputStream outputStream = System.out;
          FastReader in = new FastReader();
          PrintWriter out = new PrintWriter(outputStream);
          PROBLEM solver = new PROBLEM();
          int t = 1;
          t = in.nextInt();
          for (int i = 0; i < t; i++) {
              solver.solve(in, out);
          }
          out.close();
      }
  
      static class PROBLEM {
  
          public void solve(FastReader in, PrintWriter out) {
  
              int n = in.nextInt();
              int[] a = in.readArray(n);
  
              int ans = 0;
              for (int i = 0; i < n; i++) {
                  if(a[i] > i+1){
                      ans = Math.max(ans, a[i]-i-1);
                  }
              }
  
              out.println(ans);
  
  
  
          }
      }
  
      static HashMap<Integer, Integer> initializeMap(int n){
          HashMap<Integer,Integer> hm = new HashMap<>();
          for (int i = 0; i <= n; i++) {
              hm.put(i, 0);
          }
          return hm;
      }
  
      static boolean isRegular(char[] c){
  
          Stack<Character> s = new Stack<>();
          for (char value : c) {
              if (s.isEmpty() && value == ')') return false;
  
              if (value == '(') s.push(value);
              else s.pop();
          }
  
          return s.isEmpty();
      }
  
      static ArrayList<ArrayList<Integer>> createAdj(int n, int e){
  
          FastReader in = new FastReader();
          ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
  
          for (int i = 0; i < n + 1; i++) {
              adj.add(new ArrayList<>());
          }
  
          for (int i = 0; i < e; i++) {
  
              int a = in.nextInt(), b = in.nextInt();
              System.out.println(a);
  
              adj.get(a).add(b);
              adj.get(b).add(a);
          }
  
  
          return adj;
      }
  
      static int binarySearch(int[] a, int l, int r, int x){
          if(r>=l){
              int mid = l + (r-l)/2;
  
              if(a[mid] == x) return mid;
  
              if(a[mid] > x) return binarySearch(a, l, mid-1, x);
              else return binarySearch(a,mid+1, r, x);
          }
          return -1;
      }
  
      static boolean isPalindromeI(int n){
  
          int d = 0;
          int y = n;
          while(y>0){
              d++;
              y/=10;
          }
  
          int[] a = new int[d];
          for (int i = 0; i < d; i++) {
              a[i] = n%10;
              n/=10;
          }
  
          System.out.println(Arrays.toString(a));
          for (int i = 0; i < d / 2; i++) {
              if(a[i] != a[d-i-1]) return false;
          }
          return true;
      }
  
      static int gcd(int a, int b) {
          if (b == 0) return a;
          return gcd(b, a % b);
      }
  
      static boolean isSquare(double a) {
          boolean isSq = false;
          double b = Math.sqrt(a);
          double c = Math.sqrt(a) - Math.floor(b);
  
          if (c == 0) isSq = true;
  
          return isSq;
      }
  
      static int exponentMod(int A, int B, int C) {
  
          // Base cases
          if (A == 0)
              return 0;
          if (B == 0)
              return 1;
  
          // If B is even
          long y;
          if (B % 2 == 0) {
              y = exponentMod(A, B / 2, C);
              y = (y * y) % C;
          }
  
          // If B is odd
          else {
              y = A % C;
              y = (y * exponentMod(A, B - 1, C) % C) % C;
          }
  
          return (int) ((y + C) % C);
      }
  
  
      static class Pair implements Comparable<Pair>{
  
          int x, y;
  
          Pair(int x, int y){
              this.x = x;
              this.y = y;
          }
  
          public int compareTo(Pair o){
              int ans = Integer.compare(y, o.y);
              //if(o.y == y) ans = Integer.compare(x, o.x);
  
              return ans;
          }
      }
  
      static class Tuple implements Comparable<Tuple>{
  
          int x, y, id;
  
          Tuple(int x, int y, int id){
              this.x = x;
              this.y = y;
              this.id = id;
          }
  
          public int compareTo(Tuple o){
              int ans = Integer.compare(x, o.x);
              if(o.x == x) ans = Integer.compare(y, o.y);
  
              return ans;
          }
      }
  
  //    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
  //        public U x;
  //        public V y;
  //
  //        public Pair(U x, V y) {
  //            this.x = x;
  //            this.y = y;
  //        }
  //
  //        public int hashCode() {
  //            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
  //        }
  //
  //        public boolean equals(Object o) {
  //            if (this == o)
  //                return true;
  //            if (o == null || getClass() != o.getClass())
  //                return false;
  //            Pair<U, V> p = (Pair<U, V>) o;
  //            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
  //        }
  //
  //        public int compareTo(Pair<U, V> b) {
  //            int cmpU = x.compareTo(b.x);
  //            return cmpU != 0 ? cmpU : y.compareTo(b.y);
  //        }
  //
  //        public String toString() {
  //            return String.format("(%s, %s)", x.toString(), y.toString());
  //        }
  //
  //    }
  
      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();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          char nextChar() {
              return next().charAt(0);
          }
  
          boolean nextBoolean() {
              return !(nextInt() == 0);
          }
          // boolean nextBoolean(){return Boolean.parseBoolean(next());}
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          public int[] readArray(int size) {
              int[] array = new int[size];
              for (int i = 0; i < size; i++) array[i] = nextInt();
              return array;
          }
  
      }
  
      private static int[] mergeSort(int[] array) {
  
          //array.length replaced with ctr
          int ctr = array.length;
          if (ctr <= 1) {
              return array;
          }
  
          int midpoint = ctr / 2;
  
          int[] left = new int[midpoint];
          int[] right;
  
          if (ctr % 2 == 0) {
              right = new int[midpoint];
          } else {
              right = new int[midpoint + 1];
          }
  
          for (int i = 0; i < left.length; i++) {
              left[i] = array[i];
          }
  
          for (int i = 0; i < right.length; i++) {
              right[i] = array[i + midpoint];
          }
  
          int[] result = new int[array.length];
  
          left = mergeSort(left);
          right = mergeSort(right);
  
          result = merge(left, right);
  
          return result;
      }
  
      private static int[] merge(int[] left, int[] right) {
  
          int[] result = new int[left.length + right.length];
          int leftPointer = 0, rightPointer = 0, resultPointer = 0;
  
          while (leftPointer < left.length || rightPointer < right.length) {
  
              if (leftPointer < left.length && rightPointer < right.length) {
  
                  if (left[leftPointer] < right[rightPointer]) {
                      result[resultPointer++] = left[leftPointer++];
                  } else {
                      result[resultPointer++] = right[rightPointer++];
                  }
              } else if (leftPointer < left.length) {
                  result[resultPointer++] = left[leftPointer++];
              } else {
                  result[resultPointer++] = right[rightPointer++];
              }
          }
          return result;
      }
  
      public static void Sieve(int n) {
  
          Arrays.fill(primecheck, true);
          primecheck[0] = false;
          primecheck[1] = false;
  
          for (int i = 2; i * i < n + 1; i++) {
              if (primecheck[i]) {
                  for (int j = i * 2; j < n + 1; j += i) {
                      primecheck[j] = false;
                  }
              }
          }
      }
  }
  
  
  