You are given an array **A **of size **N**. The task is to find count of elements before which all the elements are smaller. First element is always counted as there is no other element before it.

**Input:**

The first line of input will contain number of test cases **T** . Then **T** test cases follow . Each test case contains 2 lines on input. The first line contains an integer **N** denoting the number of elements in the array. The next line contains **N** space separated integer's denoting the elements of the array.

**Output:**

For each test case, print the Number of Elements before which no element is bigger.

**Constraints:**

1 <= T<= 100

1 <= N <= 10^{7}

1<= A_{i} <=10^{18}

**Example:**

**Input**

2

6

10 40 23 35 50 7

3

5 4 1

**Output**

3

1

**Explanation**

**Test Case 1:**

Input: arr[] = {10, 40, 23, 35, 50, 7}

Output: 3

The elements are 10, 40 and 50.

No of elements is 3

**Test Case 2**:

Input: arr[] = {5, 4, 1}

Output: 1

There is only one element 5

No of element is 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

SumitSingh27 | 72 |

SanketAgarwal1 | 54 |

rathiarpit29 | 52 |

ujjwalsoni1999 | 52 |

vishalkumar61 | 50 |

SumitSingh27 | 398 |

saiujwal13083 | 279 |

ujjwalsoni1999 | 277 |

NaveenKumarNakka | 275 |

_maverick7_ | 266 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.