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
    if s[0] == "<":
        if s[-1] == "<":
            ans.append(0)
        else:
            ans.append(1)
    else:
        ans.append(0)
for a in ans:
    print(a)
