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