t=int(input())
for i in range(0,t):
    #n=R(int)[0]
    n=int(input())
    #s=R(str)[0]
    s=str(input())
    #l = list(s)
    if((s[0]=='<') & (s[n-1]=='>')):
        print("1")
    else:
        print("0")