#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    string s;
    cin >> s;
    if (s[0] == '>' || s[n - 1] == '<') {
      printf("0\n");
      continue;
    } else {
      printf("1\n");
      continue;
    }
  }
}
