lines_count = int(raw_input())
for i in xrange(lines_count):
    line_len = int(raw_input())
    line = str(raw_input()).strip()

    if line_len >= 2:
        if line[0] == '<' and line[-1] == '>':
            print 1
        else:
            print 0
    else:
        print 0
