#include <bits/stdc++.h>
using namespace std;
char a[110];
int num;
int main() {
  int t;
  int n;
  cin >> t;
  while (t--) {
    cin >> n;
    int num = 0;
    int q = 0;
    cin >> a;
    for (int i = 0; i < n; i++) {
      if (a[i] == '<') {
        num++;
        q = i;
        break;
      }
    }
    for (int i = q; i < n; i++) {
      if (a[i] == '>') {
        num++;
        break;
      }
    }
    if (num == 2) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
  return 0;
}
