t = int(input())
for i in range(t):
    n = int(input())
    s = input()
    if n == 1:
        print(0)
    else:
        if s.count('<>') != 0:
            if s[0] == '>' or s[-1] == '<' and (s[0] != '<' or s[-1] != '>'):
                print(0)
            else:
                print(1)
        else:
            print(0)
