import java.util.*;
import java.util.HashMap;

public class solution {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int t = input.nextInt();
		while(t--!=0)
		{	
		input.nextInt();
		String str = input.next();
		int len = str.length();
		int ans;
		if(str.charAt(len-1)=='<' && str.charAt(0)=='>')
			ans=0;
		else
			ans=1;
		System.out.println(ans);
		
}
}
}
