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