import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		while(a-->0) {
			int n=sc.nextInt();
			String t=sc.nextLine();
			t=sc.nextLine();
			int length = t.length();
			int ans=0;
			for(int i=0;i<length-1;i++) {
				if(t.charAt(i)=='<'&&t.charAt(i+1)=='>') {
					ans=1;
					break;
				}
			}
			System.out.println(ans);
			
			
			
			
		}
		
	}
}