#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
const long long MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
  return 0;
}
