import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class BB {
	static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		InputReader scan = new InputReader(new BufferedInputStream(System.in));
		int t = scan.nextInt();
		for (int i=0;i<t;i++) {
			int len = scan.nextInt(), ans = 0; String s = scan.next();
			if (s.charAt(0) == '>' || s.charAt(s.length()-1) == '<') {
				ans=0;
			} else if (all(s,'<') || all(s,'>'))
				ans =0;
			else 
				ans=1;
			System.out.println(ans);
		}
		
		scan.close();
	}
	
	private static boolean all(String s, char c) {
		for (int i=0;i<s.length();i++)
			if (s.charAt(i)!=c)return false;
		return true;
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public void close() throws IOException {
			this.stream.close();
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public boolean isSpaceChar(int c) {
			if (filter != null) {
				return filter.isSpaceChar(c);
			}
			return isWhitespace(c);
		}

		public interface SpaceCharFilter {

			public boolean isSpaceChar(int ch);
		}

		public String next() {
			return nextString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public Long nextLong() {
			return Long.parseLong(nextString());
		}

		public Double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public char nextCharacter() {
			return nextString().charAt(0);
		}

		public int[] nextIntArray(int N) {
			int A[] = new int[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextInt();
			}
			return A;
		}

		public long[] nextLongArray(int N) {
			long A[] = new long[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextLong();
			}
			return A;
		}

		public double[] nextDoubleArray(int N) {
			double A[] = new double[N];
			for (int i = 0; i < N; i++) {
				A[i] = nextDouble();
			}
			return A;
		}
	}

	int min(int... a) {
		int min = Integer.MAX_VALUE;
		for (int v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	long min(long... a) {
		long min = Long.MAX_VALUE;
		for (long v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	double min(double... a) {
		double min = Double.MAX_VALUE;
		for (double v : a) {
			min = Math.min(min, v);
		}
		return min;
	}

	int max(int... a) {
		int max = Integer.MIN_VALUE;
		for (int v : a) {
			max = Math.max(max, v);
		}
		return max;
	}

	long max(long... a) {
		long max = Long.MIN_VALUE;
		for (long v : a) {
			max = Math.max(max, v);
		}
		return max;
	}

	double max(double... a) {
		double max = Double.MIN_VALUE;
		for (double v : a) {
			max = Math.max(max, v);
		}
		return max;
	}
}