

import java.util.Scanner;

public class MyClass {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s;
        long test = in.nextInt();


        while(test>0)
        {
            int n = in.nextInt();
            in.nextLine();
            s = in.nextLine();
            long ans = 0;


                if(s.charAt(0) == '>' || s.charAt(n-1) == '<')
                    ans = 0;
                else
                    ans = 1;
                    System.out.println(ans);
            test--;
        }
    }
}
