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