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