#include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> s;
    if (s.size() == 1 || s[0] == '>' || s[s.size() - 1] == '<') {
      cout << "0\n";
    } else
      cout << "1\n";
  }
}
