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