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