//package src;
//|__|  /_\   /_\  |\ |

//|  | /   \ /   \ | \|

//|__|  /_\   /_\  |\ |
//|  | /   \ /   \ | \|
import java.util.Scanner;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Stack;
import java.util.TreeMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.lang.StringBuilder;
import java.math.BigInteger;

public class idk {
	static Scanner scn = new Scanner(System.in);
	static int count = 0;

	public static void main(String[] args) {
		int t=scn.nextInt();
		while(t-->0) {
			int n=scn.nextInt(),a=-1,b=-1;
		String str=scn.next();
		for(int i=0;i<n;i++)
		{
			if(str.charAt(i)=='>')
			{
				a=i;
				break;
			}
				
		}
		for(int i=n-1;i>=0;i--)
		{
			if(str.charAt(i)=='<')
			{
				b=i;
				break;
			}
		}
		if(a>=0&&b>=0)
		{
			
			 if(a==0||b==n-1)
				System.out.println("0");
			 else if(a>0&&b<n-1)
			 {
				System.out.println("1"); 
			 }
		}
		else
			System.out.println("0");
		
		}
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	public static String factorial(int n) {
		BigInteger fact = new BigInteger("1");
		for (int i = 1; i <= n; i++) {
			fact = fact.multiply(new BigInteger(i + ""));
		}
		return fact.toString();
	}
}
