t = int(input())
tests = []
for i in range(t):
    length = int(input())
    tests.append(input())
    
def solve(s):
    if s[0] == ">" or s[-1] == "<":
        return 0
    else:
        return 1

res = list(map(lambda x: str(solve(x)), tests))
print("\n".join(res))