queries = int(raw_input())

for i in range(queries):
    lenString = int(raw_input())
    string = raw_input()

    if(string[0] == '<' and string[lenString-1] == '>'):
        print('1')
    else:
        print('0')