def f(k, a):
    if k == 1: return 0
    if a[0] == "<" or a[-1] == ">": return 1
    return 0


q = int(raw_input())

for __ in range(q):
    k = int(raw_input())
    a = list(raw_input())
    print(f(k, a))
		 	 	  			 		   	    	      	