#!/usr/bin/env python3
# -*- coding: utf-8 -*-


n = int(input())



for i in range(n):
    l = int(input())
    s = input()
    
    ibegin = s.find('>')
    iend   = s[::-1].find('<') 
    if (ibegin>0) and (iend > 0):
        print(1)
    else:
        print(0)



