a=input()
for i in range(a):
    b=input()
    c=raw_input()
    d=-1
    for j in range(b):
        if(c[j]=="<"):
            d=j
    if(d==(-1)):
        print 0
    if(d==(b-1)):
        print 0
    if((d!=(b-1)) and (d!=(-1))):
        print 1


