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