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 = true;
			outer: for (int j = 0; j < n; j++) {
				if (s[j] == '<') {
					for (int k = j + 1; k < n; k++) {
						if (s[k] == '>') {
							f = false;
							break outer;
						}
					}
				}
			}
			System.out.println(f ? 0 : 1);
		}

	}
}