import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())


for t in xrange(input()):
	n = input()
	s = raw_input()
	if s[0] == '>' or s[n-1] == '<':
		print 0
		continue
	print 1
