#include using namespace std; using i64 = int64_t; #define _for(i, l, r, vals...) \ for (decltype(l + r) i = (l), i##end = (r), ##vals; i <= i##end; ++i) template bool chkmin(T &a, T b) { return b < a ? a = b, true : false; } template bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } const uint32_t OFFSET = 5; const uint32_t N = 1e5 + OFFSET, M = 2e5 + OFFSET, K = 21; int a[N]; auto solve() -> void { int n; cin >> n; i64 sum = 0; _for(i, 1, n) cin >> a[i]; int ans = 0; _for(i, 2, n) if (a[i] < a[i - 1]) { ++ans; ++i; } cout << ans << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int _t; cin >> _t; while (_t--) solve(); return 0; }