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

public class B {

    public static void main(String[] args) throws Exception {
        FastScanner scanner = new FastScanner();

        int T = scanner.nextInt();

        while (T-- != 0) {
            int n = scanner.nextInt();
            String s = scanner.nextLine();
            int i = 0;
            while (i < s.length()) {
                if (s.charAt(i) == '>')
                    break;
                i++;
            }
            if (i == s.length() || i == 0) {
                System.out.println(0);
            } else {
                System.out.println(1);
            }
        }
    }

    private static class FastScanner {
        private BufferedReader br;

        public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); }
        public int nextInt() throws IOException { return Integer.parseInt(br.readLine()); }
        public String nextLine() throws IOException { return br.readLine(); }
    }
}
