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