import java.util.Scanner;

public class TaskB {

    public static void main(String[] args) {
        new TaskB().run();
    }

    private void run() {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        for (int i = 0; i < n; i++) {
            in.nextInt();
            String s = in.next();
            String s1 = s.replace("><", ">");
            String s2 = s.replace("><", "<");
            while (s1.contains("><")) {
                s1 = s1.replace("><", ">");
            }

            while (s2.contains("><")) {
                s2 = s2.replace("><", "<");
            }

            if (s1.length() <= 1 || s2.length() <= 1) {
                System.out.println(0);
            } else {
                int count1 = isGood(s1) ? 1 : 0;
                int count2 = isGood(s2) ? 1 : 0;
                System.out.println(Math.min(count1, count2));
            }
        }

    }

    boolean isGood(String s) {
        return s.charAt(0) == '<' || s.charAt(s.length() - 1) == '>';
    }

}

