#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int maxn = 1e5 + 10;
int a[maxn];
int main() {
  int t = read();
  while (t--) {
    int n = read();
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 1; i < n; i++) {
      if (s[i - 1] == '<' && s[i] == '>') {
        ans = 1;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
