import java.util.Scanner;

public class B {

    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int T = sc.nextInt();
    while (T > 0) {
        T--;
        int count = sc.nextInt();
        int[] buffer = new int[12];
        for (int i = 0; i < 12; i++) {
            buffer[i] = sc.nextInt();
        }
        int islandCount = 0;
        for (int k = 1; k < 11; k++) {
                for (int j = k; j < 11; j++) {
                    int min = Integer.MAX_VALUE;
                    for (int s = k; s <= j; s++) {
                        if (buffer[s] < min) {
                            min = buffer[s];
                        }
                    }
                    if (buffer[k - 1] < min && buffer[j + 1] < min) {
                        islandCount++;
                        //System.out.println(k + " " + j);
                    }
                }
        }
        System.out.println(count + " " + islandCount);
    }
    }
}