

import java.io.*;
import java.util.*;

public class Contest {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		for (int i = 0; i < t; i++) {
			int n = Integer.parseInt(br.readLine());
			char[] s = br.readLine().toCharArray();
			boolean f = false;
			if (s[0] == '>' || s[s.length - 1] == '<')
				f = true;
			System.out.println(f ? 0 : 1);
		}

	}
}