t = int(input())
n_list = []
s_list = []
for i in range(t):
    n_list.append(int(input()))
    s_list.append(input())

ans = []

for i in range(t):
    n = n_list[i]
    s = s_list[i]
    cnt = 0

    last_a = 0
    last_b = 0
    for j in range(len(s)):
        if s[j] == "<":
            last_a = j
        else:
            last_b = j
    if last_a < last_b:
        ans.append(1)
    else:
        ans.append(0)

for a in ans:
    print(a)
