import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B1140 {

	public static void main(String[] args) throws NumberFormatException, IOException {
//		BufferedReader br = new BufferedReader(new FileReader("F:/books/input.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int T = Integer.parseInt(br.readLine());
		StringBuffer sb = new StringBuffer("");
		while(T-->0) {
			int n = Integer.parseInt(br.readLine());
			String s = br.readLine();
			if(s.charAt(0)=='<' && s.charAt(n-1)=='>')
				sb.append("1\n");
			else sb.append("0\n");
		}
		System.out.println(sb.toString());
	}

}
