Most problems on CodeChef highlight chef's love for food and cooking but little is known about his love for racing sports. He is an avid Formula 1 fan. He went to watch this year's Indian Grand Prix at New Delhi. He noticed that one segment of the circuit was a long straight road. It was impossible for a car to overtake other cars on this segment. Therefore, a car had to lower down its speed if there was a slower car in front of it. While watching the race, Chef started to wonder how many cars were moving at their maximum speed.
Formally, you're given the maximum speed of N cars in the order they entered the long straight segment of the circuit. Each car prefers to move at its maximum speed. If that's not possible because of the front car being slow, it might have to lower its speed. It still moves at the fastest possible speed while avoiding any collisions. For the purpose of this problem, you can assume that the straight segment is infinitely long.
Count the number of cars which were moving at their maximum speed on the straight segment.

-----Input-----
The first line of the input contains a single integer T denoting the number of test cases to follow. Description of each test case contains 2 lines. The first of these lines contain a single integer N, the number of cars. The second line contains N space separated integers, denoting the maximum speed of the cars in the order they entered the long straight segment.

-----Output-----
For each test case, output a single line containing the number of cars which were moving at their maximum speed on the segment.

-----Example-----
Input:
3
1
10
3
8 3 6
5
4 5 1 2 3

Output:
1
2
2

-----Constraints-----

1 ≤ T ≤ 100

1 ≤ N ≤ 10,000

All speeds are distinct positive integers that fit in a 32 bit signed integer.

Each input file will not be larger than 4 MB (4,000,000,000 bytes) in size.

WARNING! The input files are very large. Use faster I/O.

Starter code:

Solutions:
for _ in range(int(input())):
 n = int(input())
 l = list(map(int,input().split()))
 ans = 1
 l1 = l[0]
 for i in range(1,n):
  if l[i] <= l1:
   l1 = l[i]
   ans = ans + 1
 print(ans)

for _ in range(int(input())):
 n = int(input())
 l = list(map(int,input().split()))
 ans = 1
 l1 = l[0]
 for i in range(1,n):
  if l[i] <= l1:
   l1 = l[i]
   ans = ans + 1
 print(ans)

input_1 = int(input())

for i in range(input_1):
 input_2 = int(input())
 arr = list(map(int, input().split()))
 count = 1
 mini = arr[0]
 if input_2 ==1:
  print(count)
 else:
  for j in range(1,input_2):
   if arr[j] <= mini:
    mini = arr[j]
    count = count +1
  print(count)

# cook your dish here
import sys
def get_ints(): return list(map(int, sys.stdin.readline().strip().split()))
t = int(input())
for _ in range(t):
 n = int(input())
 cars = get_ints()
 counter = 1
 if n == 1:
  print(1)
 else:
  min = cars[0]
  for i in range(1,n):
   if cars[i] <= min:
    counter +=1 
    min = cars[i]
  print(counter)

# cook your dish here
for _ in range(int(input())):
 n=int(input())
 l=[int(item) for item in input().split(maxsplit=n)[:n]]
 count=1
 mini=l[0]
 if n==1:
  print(1)
 else:
  for i in range(1,n):
   if l[i]<=mini:
    mini=l[i]
    count=count+1
  print(count) 

t=int(input())
for x in range(t):
 n = int(input())
 lst1 = list(map(int,input().split()))
 c = 1
 m = lst1[0]
 for y in range(1,n):
  if lst1[y] <= m:
   c += 1
   m = lst1[y]
 print(c)

t=int(input())
while t:
 n = int(input())
 arr = [int(x) for x in input().split()]
 cnt = 1
 min_sp = arr[0]
 for i in range(1,n):
  if(min_sp>arr[i]):
   min_sp = min(min_sp,arr[i])
   cnt = cnt + 1
 print(cnt)
 t=t-1

for _ in range(int(input())):
 n=int(input())
 c=0
 l=list(map(int,input().split()))
 m=l[0]
 for i in l:
  if m>=i:
   c+=1
   m=i
 print(c)

t=int(input())
while t:
 n = int(input())
 arr = [int(x) for x in input().split()]
 cnt = 1
 min_sp = arr[0]
 for i in range(1,n):
  if(min_sp>arr[i]):
   min_sp = min(min_sp,arr[i])
   cnt = cnt + 1
 print(cnt)
 t=t-1

t=int(input())
while t:
 n = int(input())
 arr = [int(x) for x in input().split()]
 cnt = 1
 min_sp = arr[0]
 for i in range(1,n):
  if(min_sp>arr[i]):
   min_sp = min(min_sp,arr[i])
   cnt = cnt + 1
 print(cnt)
 t=t-1

for x in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 c=1
 t=l[0]
 for y in range(1,n):
  if l[y]<=t:
   c+=1
   t=l[y]
 print(c)
   


t = int(input())
for _ in range(t):
 n = int(input())
 s = [int(i) for i in input().split()]
 x = []
 c = 0
 for i in range(n):
  x.append(s[i])
  
 for i in range(n-1):
  if x[i]<x[i+1]:
   x[i+1]=x[i]
 
 for i in range(n):
  if s[i]==x[i]:
   c+=1
 
 print(c)
 


T = int(input())

for i in range(T):
 N = int(input())
 maxSpeeds = list(map(int, input().split()))
 
 travSpeeds = []
 
 for j in range(N):
  travSpeeds.append(maxSpeeds[j])
 
 for j in range(N - 1):
  if travSpeeds[j] < travSpeeds[j + 1]:
   travSpeeds[j + 1] = travSpeeds[j]
   
 maxSpeedCars = 0
 
 for j in range(N):
  if travSpeeds[j] == maxSpeeds[j]:
   maxSpeedCars += 1
   
 print(maxSpeedCars)

def race(speed):
 ms=None
 c=1
 for i in speed:
  if ms == None:
   ms=i
  elif i<ms:
   ms=i
   c=c+1
 return c
for i in range(int(input())):
 n=int(input())
 speed=list(map(int,input().split()))
 print(race(speed))

def maxSpeed(arr, l):
 count = 0
 Min = 10000000000000
 for i in arr:
  if i < Min:
   Min = i
   count += 1
   
 return count


t = int(input())
for i in range(t):
 l = int(input())
 arr = list(map(int, input().split()))
 print(maxSpeed(arr, l))

'''
n=1
10

1
--------
n=3
8 3 6

2
--------
n=5
4 5 1 2 3

2
'''

t=int(input())
for i in range(t):
 n=int(input())
 l1=list(map(int, input().split()))
 curr=l1[0]
 ans=0
 for j in range(n):
  if(l1[j]<=curr):
   ans+=1
   curr=l1[j]
 print(ans)

# cook your dish here
t=int(input())
for i in range(t):
 k=0
 n=int(input())
 l=list(map(int,input().split()))
 max=l[0]
 for j in range(n):
  if l[j]<=max:
   k=k+1
   max=l[j]
 print(k)

T = int(input())

for _ in range(T):
 N = int(input())
 cars = list(map(int, input().split()))
 ans = 0
 for i in range(len(cars)):
  if i == 0:
   ans += 1
  else:
   if cars[i - 1] < cars[i]:
    cars[i] = cars[i - 1]
   else:
    ans += 1
 print(ans)

test = int(input())
for i in range(test):
 no_cars = int(input())
 L = [int(x) for x in input().split()]
 cars_fast = 1 #first car will run at maximum speed
 for j in range(no_cars-1):
  if L[j] >= L[j+1]:
   cars_fast = cars_fast + 1
  else:
   L[j+1] = L[j]
 print(cars_fast)

# cook your dish here
t=int(input())

for t in range(t):
 n=int(input())
 a=[int(x) for x in input().split()]
 counter=0
 current=a[0]
 for i in range(0,len(a)):
  if a[i]<=current:
   counter=counter + 1 
   current=a[i]
 
 print(counter)
   


t=int(input())
l=[]
for i in range(t):
 n=int(input())
 a=list(map(int,input().split()))
 count=0
 for j in range(n-1):
  if a[j]<=a[j+1]:
   a[j+1]=a[j]
   count+=1
 l.append(n-count)
for i in l:
 print(i)

   
   
 
  
 
 
   
  
   
  
  


t=int(input())
for i in range(t):
 n=int(input())
 hello=list(map(int,input().strip().split()))
 count=0
 for i in range(len(hello)-1):
  if hello[i+1]>hello[i]:
   hello[i+1]=hello[i]
   count=count+1
 print(n-count)



# cook your dish here
t_cases= int(input())
for i in range(t_cases):
 n_cars = int(input())
 max_speeds = list(map(int, input().split()))
 res = 0
 for j in range(n_cars-1):
  if max_speeds[j+1] > max_speeds[j]:
   max_speeds[j+1] = max_speeds[j]
   res += 1
 print(n_cars-res)

# cook your dish here
for T in range(int(input())):
 n=int(input())
 li=(list(map(int,input().split())))[:n]
 cnt=1
 for i in range(1,n):
  if li[i]-li[i-1]<0:
   cnt+=1
  else:
   li[i]=li[i-1]
 print(cnt)


for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 count=1
 if len(l)==1:
  print(1)
  continue
 for i in range(1,len(l)):
  if l[i]<l[i-1]:
   count+=1
  elif l[i-1]<l[i]:
   l[i]=l[i-1]
 print(count)