#include <bits/stdc++.h>
using namespace std;
long long int n, ans;
vector<long long int> a, ng;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> inc;
    int l = 1;
    for (int i = 1; i < n - 1; i++) {
      if (a[i] < a[i + 1])
        l++;
      else {
        inc.push_back(l);
        l = 1;
      }
    }
    inc.push_back(l);
    int af = 1, cur = 0, ans = 0, f = 1;
    for (auto x : inc) {
      if (af) {
        if (f) {
          ans++;
          f = 0;
        }
        cur += x;
        af--;
      }
      if (!af) {
        af = cur;
        cur = 0;
        f = 1;
      }
    }
    cout << ans << '\n';
  }
}
