#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> k;
  while (k--) {
    cin >> n;
    string s;
    cin >> s;
    if (n == 1) {
      cout << "0";
    } else {
      if (s[0] == '>' || s[n - 1] == '<') {
        cout << "0";
      } else if (s[n - 1] == '>') {
        int f = 0;
        for (int i = 0; i < n - 1; i++) {
          if (s[i] == '>') {
            f = 1;
            break;
          }
        }
        if (f == 1) {
          cout << "0";
        } else {
          cout << "1";
        }
      } else {
        int f = 0;
        for (int i = 1; i < n; i++) {
          if (s[i] == '<') {
            f = 1;
            break;
          }
        }
        if (f == 1) {
          cout << "0";
        } else {
          cout << "1";
        }
      }
    }
    cout << endl;
  }
  return 0;
}
