#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << 0 << "\n";
    } else if (s[0] == '<') {
      bool ch = true;
      for (int i = 1; i < n; i++) {
        if (s[i] = '>') ch = false;
      }
      if (ch)
        cout << 0 << "\n";
      else
        cout << 1 << "\n";
    } else if (s[n - 1] == '>') {
      bool ch = true;
      for (int i = 0; i < n; i++) {
        if (s[i] = '<') ch = false;
      }
      if (ch)
        cout << 0 << "\n";
      else
        cout << 1 << "n";
    }
  }
  return 0;
}
