t = int(input())
for _ in range(t):
    n = int(input())
    string = input()
    s = [string[i] for i in range(n)]
    le = n
    ge = -1
    for i in range(n):
        if s[i] == "<":
            le = i
            break
    for i in range(n-1,-1,-1):
        if s[i] == ">":
            ge = i 
            break
    if le < ge:
        print(1)
    else :
        print(0)
        