#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1, -1, 0, 0};
int fy4[] = {0, 0, 1, -1};
int Kfx[] = {-2, -2, 2, 2, 1, 1, -1, -1};
int Kfy[] = {1, -1, 1, -1, 2, -2, 2, -2};
int fx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
int fy8[] = {0, 1, -1, 1, -1, 0, 1, -1};
long long int BM(long long int a, long long int b, long long int m) {
  if (b == 0) return 1;
  long long int x = BM(a, b / 2, m);
  x = ((x % m) * (x % m)) % m;
  if (b % 2) x = ((x % m) * (a % m)) % m;
  return x;
}
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    int n;
    scanf("%d", &n);
    string a, b = "", c = "";
    cin >> a;
    int plcg = -1;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == '>') {
        plcg = i;
        break;
      }
    }
    int plcl = -1;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == '<') {
        plcl = i;
      }
    }
    if (plcg == -1 or plcl == -1) {
      printf("0\n");
      continue;
    }
    int f1 = 0, f2 = 0;
    for (int i = 0; i <= plcg; i++) {
      b += a[i];
      if (a[i] == '<') f1 = 1;
    }
    for (int i = plcl; i < a.size(); i++) {
      c += a[i];
      if (a[i] == '>') f2 = 1;
    }
    if (f1 == 0 or f2 == 0)
      printf("0\n");
    else if (f1 == 1 and f2 == 1)
      printf("1\n");
  }
}
