#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  int c;
  vector<int> d;
  vector<int> ans;
  const int max = 2e+5;
  scanf("%d", &n);
  d.resize(max);
  ans.resize(n);
  for (int in = 0; in < n; in++) {
    scanf("%d", &k);
    int idx = 0;
    d[idx] = 0;
    scanf("%d", &c);
    int x;
    for (int i = 1; i < k; i++) {
      scanf("%d", &x);
      if (x < c) {
        idx++;
      }
      d[i] = d[idx] + 1;
      c = x;
    }
    ans[in] = d[k - 1];
  }
  for (int i = 0; i < n; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
