/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming

Solution to Eating Game (A): https://codeforces.com/contest/2200/problem/A
Explanations: https://codeforces.com/blog/entry/151625
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    //Process test cases
    int t; cin >> t;
    while(t--) {
        int n; cin >> n;
        //Keep track of max value and frequency of this value
        int maxv = 0, maxn = 0;
        for(int i = 0; i < n; i++) {
            int x; cin >> x;
            if(x == maxv) maxn++;
            //If x is a new maximum, reset the counter and set maxv to x
            else if(x > maxv) {
                maxv = x, maxn = 1;
            }
        }
        //Display the number of maximums in the array
        cout << maxn << '\n';
    }
}