n = int(input())
for i in range(n):
    a = int(input())
    s = input()
    answer = 0
    x, y = a - 1, 0
    if '>' in s:
        x = s.index('>')
    if '<' in s:
        s = s[::-1]
        y = a - s.index('<') - 1
        s = s[::-1]
    num = a // 2
    for j in range(a - 1):
        if s[j] == '<' and s[j + 1] == '>':
            num = j
            break
    s = s[::-1]
    num1 = a // 2
    for j in range(a - 1):
        if s[j] == '<' and s[j + 1] == '>':
            num1 = a - j - 1
            break
    if (x < num or y > num) and (x < num1 or y > num1) or a == 1:
        answer = 0
    else:
        answer = 1
    print(answer)