#include <bits/stdc++.h>
using namespace std;
int main() {
  long long test;
  cin >> test;
  while (test--) {
    long long len;
    cin >> len;
    string str;
    cin >> str;
    long long less = 0, greater = 0;
    if (len == 1)
      cout << "0" << endl;
    else {
      for (long long i = 0; i < str.size(); i++) {
        if (str[i] == '<')
          less++;
        else
          greater++;
      }
      if (less == greater) {
        cout << "1" << endl;
      } else if (less == len || greater == len)
        cout << "0" << endl;
      else
        cout << "1" << endl;
    }
  }
  return 0;
}
