#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y / 2;
    if (y != 0) x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, n, r, i, j, ans, k, temp, var, x, prev, curr, sz;
  cin >> t;
  while (t--) {
    cin >> n;
    long long a[n + 5];
    for (i = 0; i < n; i++) cin >> a[i];
    var = ans = prev = 1;
    for (i = 2; i < n;) {
      while (i < n && a[i] > a[i - 1]) {
        var++;
        i++;
      }
      while (i < n && a[i] < a[i - 1]) {
        prev--;
        if (prev == 0) {
          ans++;
          prev = var;
          var = 0;
        }
        i++;
        var++;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
