t = int(input())

for _ in range(t):
    n = int(input())
    s = input()
    hasOC = True if "<>" in s else False
    if hasOC:
        aa = s.index("<>")
        bb = s.rindex("<>")
        if ">" in s[0:aa] or "<" in s[bb+2:]:
            print(0)
        else:
            print(1)
    else:
       print(0)