import sys, collections

tc = int(sys.stdin.readline())
for _ in range(tc):
    n = int(sys.stdin.readline())
    arr = list(sys.stdin.readline().rstrip())
    can = False
    for i in range(n - 1):
        if arr[i] == '<' and arr[i + 1] == '>':
            can = True
            break
    print(1 if can else 0)
