import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.util.*;
import java.lang.*;
import java.util.StringTokenizer;


public class Main {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
  
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
        long nextLong()
        {
            return Long.parseLong(next());
        }
  
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
  
        String nextLine()
        {
            String str = "";
            try  {
                str = br.readLine();
            }
            catch (IOException e)  {
                e.printStackTrace();
            }
            return str;
        }
    }


    public static void main(String[] args) {
        FastReader virus = new FastReader();
            int t = virus.nextInt();
            for (int i = 0; i < t; i++) {
                int n = virus.nextInt();
                String s = virus.next();
                StringBuilder sb = new StringBuilder(s);
                
                for (int j = 0; j < n; j++) {
                    if (sb.charAt(j) == '<' && j != 0) {
                        sb.deleteCharAt(j-1);
                        n--;
                        j--;
                    }
                    else if (sb.charAt(j) == '>' && j != (n-1)) {
                        sb.deleteCharAt(j+1);
                        n--;
                    }
                }
                if (sb.equals("<>")) {
                    System.out.println(1);
                }
                else System.out.println(0);
//                int c1 = 0;
//                int c2 = 0;
//                for (int j = 0; j < n; j++) {
//                    if (sb.charAt(j) == '<') {
//                        c1++;
//                    }
//                    else if (sb.charAt(j) == '>') {
//                        c2++;
//                    }
//                }
//                if (c1 < c2) {
//                    System.out.println(c1);
//                }
//                else System.out.println(c2);
//            
        }
    }
}
