#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f;
const double pi = 3.1415926535897932384626;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int maxn = 2e5 + 5;
int t, n, a[maxn], b[maxn];
int main() {
  t = read();
  while (t--) {
    memset(b, 0, sizeof(b));
    n = read();
    for (int i = 1; i <= n; ++i) a[i] = read();
    b[1] = 0;
    int tmp = 1;
    for (int i = 2; i <= n; ++i) {
      if (a[i - 1] > a[i]) ++tmp;
      b[i] = b[tmp] + 1;
    }
    printf("%d\n", b[n]);
  }
  return 0;
}
