import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class B {
	

	
	public static void main(String[] args) throws IOException{
		FastScanner sc = new FastScanner();
		
		int yo = sc.nextInt();
		while(yo-->0) {
			int n = sc.nextInt();
			String s = sc.next();
			if(n == 0) {
				System.out.println(0);
				return;
			}
			
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(0));
			int i = 1;
			while(i < n) {
				
				while(i < n && s.charAt(i-1) == '>' && s.charAt(i) == '>') {
					i++;
				}
				
				while(i < n && s.charAt(i-1) == '<' && s.charAt(i) == '<') {
					i++;
				}
				
				if(i < n) {
					sb.append(s.charAt(i));
					i++;
				}
				
			}
			
			if(sb.length() == 1) {
				System.out.println(0);
				continue;
			}
			if(sb.charAt(0) == '>') {
				System.out.println(0);
				continue;
			}
			// <><><><> 
			boolean ok = false;
			int j = 0;
			int count = 0;
			while(j < sb.length()-1){
				if(sb.charAt(j) == '<' && sb.charAt(j+1) == '>') {
					j+=2;
					count++;
				}
				else {
					ok = true;
					break;
				}
			}
			// <>> 
			if(ok) {
				System.out.println(0);
			}
			else {
				System.out.println(1);
			}
			
		}
		
		
	}
	



	static class Pair{
		int start;
		int end;
		public Pair(int start, int end) {
			this.start = start;
			this.end = end;
		}
	}
	
	static int mod = 1000000007;
	
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}
		
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
	
	static int gcd(int a, int b) {
		return a%b == 0 ? b : gcd(b,a%b);
	}
	
	static boolean[] sieve(int n) {
		
		boolean isPrime[] = new boolean[n+1];
		for(int i = 2; i <= n; i++) {
			if(isPrime[i]) continue;
			for(int j = 2*i; j <= n; j+=i) {
				isPrime[j] = true;
			}
		
		}
		return isPrime;
		
	}
	
//	For Input.txt and Output.txt
	
//	FileInputStream in = new FileInputStream("input.txt");
//	FileOutputStream out = new FileOutputStream("output.txt");
//	PrintWriter pw = new PrintWriter(out);
//	Scanner sc = new Scanner(in);
	
// 	sc.nextLine() 
	

}
