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