#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<')
      cout << "0\n";
    else
      cout << "1\n";
  }
  return 0;
}
