import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class q5 {
	static long aa,bb;
	static long score1,score2,steps;
	static HashSet<NoD> vis;
	long gcd(long a,long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
	
	
	
	
	public static void main(String[] args) throws IOException {
		
		Reader.init(System.in);
		StringBuffer output=new StringBuffer("");
		PrintWriter out=new PrintWriter(System.out);
		int t=Reader.nextInt();
		for(int i=0;i<t;i++) {
			int n=Reader.nextInt();
			String s=Reader.next();
			int ans=0;
			int l1=-1,l2=-1;
			for(int j=0;j<n;j++) {
				if(s.charAt(j)=='<') {
					l1=j;
				}
				else {
					if(l2==-1) l2=j;
				}
				
			}
			if(l2==-1 || l1==-1) output.append(0);
			else {
				if(l2==0 || l1==n-1) output.append(0);
				else output.append(1);
			}
			output.append("\n");
		}
		out.write(output.toString());
		out.flush();
		
	}
}

class NoD{
	int a,b,c;
	NoD(int aa,int bb,int cc){
		a=aa;b=bb;c=cc;
	}
	@Override
	public boolean equals(Object o) {
		if(o!=null && o.getClass()==this.getClass() ) {
			NoD c=(NoD) o;
			return a==c.a && b==c.b;
		}
		return false;
	}
	@Override
	public int hashCode() {
		String s=Integer.toString(a);
		s+=" "+b+" "+c;
		return s.hashCode();
	}
}

class Dis {
	int[] arr;
	int[] parent;
	int[] rank;
	int[] size;
	Dis(int n){
		arr=new int[n+1];
		parent=new int[n+1];
		rank=new int[n+1];
		size=new int[n+1];
		for(int i=1;i<=n;i++) {
			arr[i]=i;
			parent[i]=i;
			rank[i]=0;
			size[i]=1;
		}
	}

	int find(int value) {
		int par=parent[value];
		if(par==value)
			return par;
		parent[value]=find(par);
		return parent[value];
	}
	
	void union(int data1,int data2) {
		int parent1=find(data1);
		int parent2=find(data2);
		if(parent1!=parent2) {
			if(rank[parent1]>=rank[parent2]) {
				parent[parent2]=parent1;
				if(rank[parent1]==rank[parent2])
					rank[parent1]++;
				size[parent1]+=size[parent2];
			}
			else {
				parent[parent1]=parent2;
				size[parent2]+=size[parent1];
			}
		}
		
	}


}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
 
    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
 
    /** get next word */
    static String nextLine() throws IOException{
    	return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}




 
 

 