import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);
		int n = scan.nextInt();
		for(int i=0;i<n;i++){
		int left = 0;
		int right = 0;
		scan.nextInt();
		String str = scan.next();
		String hold = str;
		hold = hold.replace("<", "");
        str = str.replace(">", "");
        left = hold.length();
        right = str.length();
		if(left==right){
		    System.out.println(1);
		}else{
		    System.out.println(0);
		    }
        }
	}
}
