#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <assert.h>
#include <random>
#include <sstream>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const ll STRANGE_MOD = 998244353;
const int N = int(1e4) + 211;
const int INF = int(1e9) + 111;
const ll LINF = ll(1e18) + 111;
const int P = 1931;

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define x first
#define y second

using namespace std;

typedef pair <int, int> point;
int t;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	for (int i = 0; i < t; i++) {
		int n;
		cin >> n;
		string s;
		cin >> s;
		string tmp1, tmp2;
		for (int j = 0; j < n; j++) {
			if (s[j] == '>') {
				tmp1 = s.substr(0, j + 1);
				break;
			} 
		} 
		for (int j = n - 1; j >= 0; j--) {
			if (s[j] == '<') {
				tmp2 = s.substr(j, sz(s));
				break;
			} 
		}
		if (sz(tmp1) == 1 || sz(tmp2) == 1) {
			cout << 0 << endl;
		}
		else cout << 1 << endl;
	}
	return 0;   
}