#include <bits/stdc++.h>
using namespace std;
int sol(const string& s) {
  if (s[0] == '>')
    return 0;
  else {
    if (s[s.size() - 1] == '<')
      return 0;
    else
      return 1;
  }
}
int main() {
  int t, n;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    cout << sol(s) << endl;
  }
  return 0;
}
