/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		long t;
		Scanner in=new Scanner(System.in);
		t=in.nextLong();
		for(int it=0;it<t;it++)
		{
			int n;
			n=in.nextInt();
			String p;
			p=in.next();
			int t1=0,t2=0;
			if(p.charAt(0)=='>'||p.charAt(n-1)=='<')
			{
				System.out.println("0");
				
			}
			else
			{
				
				System.out.println("1");
				
			}
			
		}
	}
}