def found():
	for i in range(n-1):
		if thing[i]=='<' and thing[i+1]=='>':
			problem = True
			problem_i = i
			break
		else:
			problem = False
			problem_i = i
	return problem,problem_i

def exe(x,y): #x is from found, y is from found
	if x == True and y == 0:
		if thing[n-1] == '<':
			return 0
		else:
			return 1
	elif x == True and y != 0:
		if thing[0] == '>' and thing[n-1] == '<':
			return 0
		else:
			return 1
	else:
		return 0

t = int(input())
for case in range(t):
	n = int(input())
	thing = input()
	if n == 1:
		ans = 0
	else:
		a,b = found()
		ans = exe(a,b)
	print(ans)
