#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
long long POW(long long b, long long p) {
  long long Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b);
    b = (b * b);
    p >>= 1;
  }
  return Ans;
}
long long BigMod(long long b, long long p, long long Mod) {
  long long Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b) % Mod;
    b = (b * b) % Mod;
    p >>= 1;
  }
  return Ans % Mod;
}
long long ModInverse(long long b, long long Mod) {
  return BigMod(b, Mod - 2, Mod);
}
string tostr(int n) {
  stringstream rr;
  rr << n;
  return rr.str();
}
void deb(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ",   ";
  deb(++it, args...);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << "0\n";
    } else
      cout << "1\n";
  }
}
