t=int(input())
def fan(k,s):
    if s[0]==">" or s[-1]=="<" or len(s)==1:
        return(0)
    else:
        return(1)            

    # if s[0]==min(a,b):
    #     return(1)
    # else:
    #     return(0)
def main():
    for _ in range(t):
        n=int(input())
        s=input()
        print(fan(n,s))



if __name__ == "__main__":
    main()        


