import java.util.*;
import java.lang.*;
import java.io.*;

/*
9
1 3 3 6 7 6 9 9 9
*/
public class Main{
	public static void main (String[] args)throws IOException{

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter (new OutputStreamWriter(System.out)));

		StringTokenizer st=new StringTokenizer(br.readLine());

		int testCases=Integer.parseInt(st.nextToken());
		
		while(testCases-->0){
			st=new StringTokenizer(br.readLine());
			int n=Integer.parseInt(st.nextToken());
			st=new StringTokenizer(br.readLine());
			String str=st.nextToken();
			if(str.charAt(0)=='>'){
				pw.println(0);
			}else if(str.charAt(n-1)=='<') {
				pw.println(0);
			}else{
				pw.println(1);
			}

			
		}


		


		pw.close();
	}
}