You are given four distinct integers $a$, $b$, $c$, $d$.

Timur and three other people are running a marathon. The value $a$ is the distance that Timur has run and $b$, $c$, $d$ correspond to the distances the other three participants ran.

Output the number of participants in front of Timur.


-----Input-----

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The description of each test case consists of four distinct integers $a$, $b$, $c$, $d$ ($0 \leq a, b, c, d \leq 10^4$).


-----Output-----

For each test case, output a single integer — the number of participants in front of Timur.


-----Examples-----

Input
4
2 3 4 1
10000 0 1 2
500 600 400 300
0 9999 10000 9998
Output
2
0
1
3


-----Note-----

For the first test case, there are $2$ people in front of Timur, specifically the participants who ran distances of $3$ and $4$. The other participant is not in front of Timur because he ran a shorter distance than Timur.

For the second test case, no one is in front of Timur, since he ran a distance of $10000$ while all others ran a distance of $0$, $1$, and $2$ respectively.

For the third test case, only the second person is in front of Timur, who ran a total distance of $600$ while Timur ran a distance of $500$.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
def main():

	def solve(a, b, c, d):
		ret = (b > a) + (c > a) + (d > a)
		return ret
	t = int(input())
	ans = []
	for _ in range(t):
		(a, b, c, d) = [int(x) for x in input().split()]
		ans.append(solve(a, b, c, d))
	print('\n'.join(map(str, ans)))
import sys, threading
input = sys.stdin.readline
thread = threading.Thread(target=main)
thread.start()
thread.join()


input = open(0).readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(int((a < b) + (a < c) + (a < d)))


import math, sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
mod1 = 1000000007
mod2 = 998244353
for _ in range(I()):
	(a, b, c, d) = M()
	cnt = 0
	if b > a:
		cnt += 1
	if c > a:
		cnt += 1
	if d > a:
		cnt += 1
	print(cnt)


import sys, math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_ls():
	return list(map(int, sys.stdin.readline().strip().split()))

def main():
	for _ in range(int(input())):
		a = get_ls()
		res = 0
		for x in a:
			if x > a[0]:
				res += 1
		print(res)
main()


import sys
for _ in range(int(sys.stdin.readline().strip())):
	(a, b, c, d) = map(int, sys.stdin.readline().strip().split())
	ans = 0
	if b > a:
		ans += 1
	if c > a:
		ans += 1
	if d > a:
		ans += 1
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	n = 0
	if b > a:
		n += 1
	if c > a:
		n += 1
	if d > a:
		n += 1
	print(n)


for s in [*open(0)][1:]:
	(a, *b) = map(int, s.split())
	print(sum((x > a for x in b)))


lst = []
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	cnt = 0
	if b > a:
		cnt += 1
	if c > a:
		cnt += 1
	if d > a:
		cnt += 1
	lst.append(cnt)
print(*lst, sep='\n')


t = int(input())
ans = []
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	ans.append(int(b > a) + int(c > a) + int(d > a))
for _ in ans:
	print(_)


for s in [*open(0)][1:]:
	l = [*map(int, s.split())]
	print(sorted([(x, i) for (i, x) in enumerate(l)])[::-1].index((l[0], 0)))


import sys

def solve(a, distance):
	res = 0
	for i in distance:
		if int(i) > a:
			res += 1
	return res
t = int(sys.stdin.readline())
for i in range(t):
	distance = sys.stdin.readline().split()
	a = int(distance[0])
	distance.pop(0)
	print(solve(a, distance))


t = int(input())
list = []
while t > 0:
	a = input().split()
	(a, b) = (int(a[0]), [int(a[1]), int(a[2]), int(a[3])])
	p = 0
	for i in b:
		if i > a:
			p += 1
	list.append(p)
	t -= 1
for i in list:
	print(i)


t = int(input())
l = []
for i in range(t):
	x = 0
	(a, b, c, d) = map(int, input().split())
	if b > a:
		x += 1
	if c > a:
		x += 1
	if d > a:
		x += 1
	l.append(x)
for i in l:
	print(i, end='\n')


cases = int(input())
ans = []
for i in range(0, cases):
	(a, b, c, d) = map(int, input().split())
	res = [a, b, c, d]
	res.sort()
	position = res.index(a)
	ans.append(4 - (position + 1))
print(*ans, sep='\n')


import sys
input = sys.stdin.readline
print = sys.stdout.write
for _ in range(int(input())):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	total = 0
	if a < b:
		total += 1
	if a < c:
		total += 1
	if a < d:
		total += 1
	print(str(total) + '\n')


import sys
voistluseid = int(sys.stdin.readline().strip())
vastused = []
for i in range(voistluseid):
	vastus = 0
	voistlejaid = list(map(int, sys.stdin.readline().strip().split()))
	meie_tegelane = voistlejaid[0]
	for j in range(1, len(voistlejaid)):
		if voistlejaid[j] > meie_tegelane:
			vastus += 1
	vastused.append(vastus)
sys.stdout.write('\n'.join(map(str, vastused)))


import sys
n = int(sys.stdin.readline())
races = []
for _ in range(n):
	races.append([int(x) for x in sys.stdin.readline().split()])
for race in races:
	count = 0
	a = race[0]
	b = race[1]
	c = race[2]
	d = race[3]
	if b > a:
		count += 1
	if c > a:
		count += 1
	if d > a:
		count += 1
	print(count)


t = int(input())
l = []
for i in range(t):
	(a, b, c, d) = input().split()
	(a, b, c, d) = (int(a), int(b), int(c), int(d))
	r = 0
	if a < b:
		r += 1
	if a < c:
		r += 1
	if a < d:
		r += 1
	l.append(r)
for i in range(t):
	print(l[i])


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	D = list(map(int, input().strip().split(' ')))
	ans = 0
	for c in D[1:]:
		if c > D[0]:
			ans += 1
	print(ans)


from sys import stdin

def main():
	test_case = stdin.readline()
	test_case = int(test_case)
	for tests in range(test_case):
		competition = stdin.readline()
		competition = list(map(int, competition.split()))
		count = 0
		for players in range(1, 4):
			if competition[0] < competition[players]:
				count += 1
		print(count)
main()


def solve():
	(a, b, c, d) = [int(i) for i in input().split()]
	return int(b > a) + int(c > a) + int(d > a)
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


t = int(input(''))
(M, T) = ([], [])
for i in range(t):
	M = input().split(' ')
	j = 0
	for x in M:
		if int(x) > int(M[0]):
			j += 1
	T.append(j)
for x in T:
	print(x)


t = int(input())
lst = []
for i in range(t):
	(a, b, c, d) = input().split(' ')
	count = 0
	if int(b) > int(a):
		count += 1
	if int(c) > int(a):
		count += 1
	if int(d) > int(a):
		count += 1
	lst.append(count)
for i in lst:
	print(i)


y = []
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	s = (a < b) + (a < c) + (a < d)
	y.append(s)
for i in y:
	print(i)


import sys
input = sys.stdin.readline

def ii():
	return int(input())

def mii():
	return map(int, input().split())

def lmii():
	return list(map(int, input().split()))
for _ in range(ii()):
	(a, b, c, d) = mii()
	n = 0
	if b > a:
		n += 1
	if c > a:
		n += 1
	if d > a:
		n += 1
	print(n)


import sys

def List():
	return list(map(int, sys.stdin.readline().split()))

def Ints():
	return map(int, sys.stdin.readline().split())

def Strs():
	return sys.stdin.readline().strip().split()

def Op(s):
	sys.stdout.write(s + '\n')

def Int():
	return int(sys.stdin.readline())

def Str():
	return sys.stdin.readline().strip()

def NList(n, l):
	return [n for i in range(l)]

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)
for i in range(Int()):
	l = List()
	k = l[0]
	c = 0
	for i in l:
		if k < i:
			c += 1
	print(c)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	count = 0
	if b > a:
		count += 1
	if c > a:
		count += 1
	if d > a:
		count += 1
	print(count)


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(int(input())):
	num = LI()
	count = 0
	if num[0] < num[1]:
		count += 1
	if num[0] < num[2]:
		count += 1
	if num[0] < num[3]:
		count += 1
	print(count)


import sys
input = sys.stdin.readline
t = int(input())
for q in range(t):
	ans = 0
	arr = list(map(int, input().split()))
	for i in range(1, 4):
		if arr[0] < arr[i]:
			ans = ans + 1
	print(ans)


from sys import stdin
input = stdin.readline
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	cnt = 0
	if a < b:
		cnt += 1
	if a < c:
		cnt += 1
	if a < d:
		cnt += 1
	print(cnt)


ls = []
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	k = 0
	for j in (b, c, d):
		if j > a:
			k += 1
	ls += [k]
for i in ls:
	print(i)


t = int(input())
l = []
for i in range(t):
	a = list(input().split(' '))
	c = 0
	timur = int(a[0])
	if int(a[1]) > timur:
		c += 1
	if int(a[2]) > timur:
		c += 1
	if int(a[3]) > timur:
		c += 1
	l.append(c)
for i in l:
	print(i)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	arr = list(map(int, sys.stdin.readline().split()))
	timur = arr[0]
	count = 0
	for d in arr:
		if d > timur:
			count += 1
	print(count)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))
n = inp()
for i in range(n):
	runners = inlt()
	timut = runners[0]
	count = 0
	for i in range(1, len(runners)):
		if runners[i] > timut:
			count += 1
	print(count)


t = int(input())
strIn = []
for _ in range(t):
	strIn.append(input())
for inp in strIn:
	players = [int(p) for p in inp.split()]
	c = 0
	for pl in players[1:]:
		if pl > players[0]:
			c += 1
	print(c)


n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
ans_v = 0
for i in s:
	for j in range(1, 4):
		if i[j] > i[0]:
			ans_v += 1
	print(ans_v)
	ans_v = 2 - 2


import sys
I = sys.stdin.readline
O = sys.stdout.write
t = int(I())
for _ in range(t):
	(a, b, c, d) = map(int, I().split())
	res = 0
	if b > a:
		res += 1
	if c > a:
		res += 1
	if d > a:
		res += 1
	O(str(res) + '\n')


def getValues():
	cantTestCases = int(input())
	testCases = []
	for i in range(cantTestCases):
		values = input().split(' ')
		testCases.append(list(map(int, values)))
	printCompetitors(testCases)

def printCompetitors(competitors):
	for i in range(len(competitors)):
		timur = competitors[i][0]
		cont = 0
		for j in range(1, len(competitors[i])):
			if competitors[i][j] > timur:
				cont += 1
		print(cont)
getValues()


def noOfParticipants(dist):
	count = 0
	for i in range(1, len(dist)):
		if dist[0] < dist[i]:
			count += 1
	return count
for _ in range(int(input())):
	dist = list(map(int, input().strip().split()))
	print(noOfParticipants(dist))


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	count = 0
	if b > a:
		count += 1
	if c > a:
		count += 1
	if d > a:
		count += 1
	print(count)


def solve(a, b, c, d):
	alist = [a, b, c, d]
	alist.sort()
	for (i, j) in enumerate(alist):
		if j == a:
			print(4 - (i + 1))
			return
for x in range(int(input())):
	ab = input().split()
	a = int(ab[0])
	b = int(ab[1])
	c = int(ab[2])
	d = int(ab[3])
	solve(a, b, c, d)


t = eval(input())
for i in range(t):
	ans = 0
	num = [int(x) for x in input().split()]
	for i in num:
		if i > num[0]:
			ans += 1
	print(ans)


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


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	f = 0
	e = (b, c, d)
	for i in e:
		if a < i:
			f += 1
	print(f)


tstcases = int(input())
for i in range(tstcases):
	runners = list(map(int, input().split()))
	tim = runners[0]
	runners.sort(reverse=True)
	print(runners.index(tim))


t = int(input())
for i in range(t):
	l = input().split()
	arr = list(map(int, l))
	cnt = 0
	for j in range(1, len(arr)):
		if arr[j] > arr[0]:
			cnt += 1
	print(cnt)


for i in range(int(input())):
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	count = 0
	if b > a:
		count = count + 1
	if c > a:
		count = count + 1
	if d > a:
		count = count + 1
	print(count)


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print((b > a) + (c > a) + (d > a))


for x in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	smth = [a, b, c, d]
	smth.sort(reverse=True)
	print(smth.index(a))
pass


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	ans = 0
	if b > a:
		ans += 1
	if c > a:
		ans += 1
	if d > a:
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	(a, b, c, d) = input().split()
	b = int(b)
	c = int(c)
	d = int(d)
	a = int(a)
	p = 0
	if a < b:
		p = p + 1
	if a < c:
		p = p + 1
	if a < d:
		p = p + 1
	print(p)
	t -= 1


def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return str(input())

def ni():
	return int(input())
for T in range(int(input())):
	(a, b, c, d) = mi()
	print(1 * (b > a) + 1 * (c > a) + 1 * (d > a))


n = int(input())
for i in range(n):
	(a, b, c, d) = [int(x) for x in input().split()]
	out = 0
	if b > a:
		out = out + 1
	if c > a:
		out = out + 1
	if d > a:
		out = out + 1
	print(out)


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	cnt = 0
	if b > a:
		cnt += 1
	if c > a:
		cnt += 1
	if d > a:
		cnt += 1
	print(cnt)


t = int(input())
for i in range(t):
	n = [int(i) for i in input().split(' ')]
	a = n[0]
	n.sort()
	print(4 - (n.index(a) + 1))


for i in range(int(input())):
	x = input().split()
	p = int(x[0])
	c = 0
	for j in x:
		if p < int(j):
			c += 1
	print(c)


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if a > b and a > c and (a > d):
		print(0)
	elif a > b and a < c and (a < d) or (a > c and a < b and (a < d)) or (a > d and a < b and (a < c)):
		print(2)
	elif a > b and a > c and (a < d) or (a > c and a > d and (a < b)) or (a > d and a > d and (a < c)):
		print(1)
	else:
		print(3)


n = int(input())
while n > 0:
	n -= 1
	a = input()
	b = a.split()
	cnt = 0
	wtf = -1
	for i in b:
		x = int(i)
		if wtf == -1:
			wtf = x
		elif x > wtf:
			cnt = cnt + 1
	print(cnt)


given = input().split()
t = int(given[0])
while t:
	cnt = 0
	dists = input().split()
	if int(dists[0]) < int(dists[1]):
		cnt = cnt + 1
	if int(dists[0]) < int(dists[2]):
		cnt = cnt + 1
	if int(dists[0]) < int(dists[3]):
		cnt = cnt + 1
	print(cnt)
	t = t - 1


def marathon(arr):
	if len(arr) == 0:
		return
	ref = arr[0]
	count = 0
	for i in range(1, len(arr)):
		if arr[i] > ref:
			count += 1
	return count
t = int(input())
for i in range(t):
	li = [int(ele) for ele in input().split()]
	print(marathon(li))


def front_runners(a, b, c, d):
	count = 0
	if a < c:
		count += 1
	if a < b:
		count += 1
	if a < d:
		count += 1
	return count
T = int(input())
for case in range(T):
	(a, b, c, d) = map(int, input().split())
	print(front_runners(a, b, c, d))


for i in range(int(input())):
	k = 0
	a = [int(s) for s in input().split()]
	if a[0] < a[1]:
		k += 1
	if a[0] < a[2]:
		k += 1
	if a[0] < a[3]:
		k += 1
	print(k)


tc = int(input())
while tc > 0:
	(a, b, c, d) = map(int, input().split())
	count = 0
	if a < b:
		count += 1
	if a < c:
		count += 1
	if a < d:
		count += 1
	print(count)
	tc -= 1


t = int(input())
for i in range(t):
	numbers = list(map(int, input().split()))
	count = 0
	j = 1
	while j < 4:
		if numbers[0] < numbers[j]:
			count += 1
		j += 1
	print(count)


for _ in range(int(input())):
	i = input()
	a_list = i.split()
	map_object = map(int, a_list)
	i = list(map_object)
	timur = i[0]
	score = 0
	for x in i[1:]:
		if x > timur:
			score += 1
	print(score)


T = int(input())
while T > 0:
	data = input().split()
	a = int(data[0])
	b = int(data[1])
	c = int(data[2])
	d = int(data[3])
	cont = 0
	if b > a:
		cont += 1
	if c > a:
		cont += 1
	if d > a:
		cont += 1
	print(cont)
	T -= 1


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


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	ar = []
	ar.extend([a, b, c, d])
	ar.sort()
	print(3 - ar.index(a))


t = int(input())
for test in range(t):
	(a, b, c, d) = map(int, input().split())
	answer = (b > a) + (c > a) + (d > a)
	print(answer)


for i in range(int(input())):
	(a, f, s, th) = map(int, input().split())
	ans = 0
	l = [f, s, th]
	for x in l:
		if a < x:
			ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	s = 0
	if b > a:
		s += 1
	if c > a:
		s += 1
	if d > a:
		s += 1
	print(s)


for i in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	p = 0
	if b > a:
		p += 1
	if c > a:
		p += 1
	if d > a:
		p += 1
	print(p)


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


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	timur = lst[0]
	lst.sort(reverse=True)
	print(lst.index(timur))