#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int i = 0;
    int flag = 0;
    while (i < n - 1) {
      if (s[i] == '<' && s[i + 1] == '>') flag = 1;
      i++;
    }
    cout << flag << endl;
  }
}
