#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9, LINF = 1e18, MOD = (1e9) + 7;
const long double PI = acos(0), EPS = 1e-9, GOLD = ((1 + sqrt(5)) / 2);
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  while (a * b != 0) {
    if (a > b)
      a = a % b;
    else
      b = b % a;
  }
  return a + b;
}
long long mod = (long long)1e9 + 7;
long long Modpow(long long a, long long b) {
  if (b == 0) return 1 % mod;
  long long d = Modpow(a, b / 2);
  if (b % 2 == 0)
    return ((d % mod) * (d % mod)) % mod;
  else
    return (a % mod * (d % mod) * (d % mod)) % mod;
}
bool cmd(pair<long long, int> a, pair<long long, int> b) {
  return (a.first > b.first);
}
struct segtree {
  int n;
  vector<long long> lazy;
  vector<long long> trenode;
  segtree(int n) {
    lazy.resize(4 * n, 0);
    trenode.resize(4 * n, 0);
  }
  void updatelazy(int i, int j, int l, int r, int node, long long x) {
    if (lazy[node] != 0) {
      trenode[node] += lazy[node];
      if (l != r) {
        lazy[node * 2] += lazy[node];
        lazy[node * 2 + 1] += lazy[node];
      }
      lazy[node] = 0;
    }
    if (l > j || r < i) return;
    if (l >= i && r <= j) {
      trenode[node] += x;
      if (l != r) {
        lazy[node * 2] += x;
        lazy[node * 2 + 1] += x;
      }
      return;
    }
    updatelazy(i, j, l, (l + r) / 2, node * 2, x);
    updatelazy(i, j, (l + r) / 2 + 1, r, node * 2 + 1, x);
    trenode[node] = trenode[node * 2] + trenode[node * 2 + 1];
  }
  long long get(int i, int j, int l, int r, int node) {
    if (l > j || r < i) return 0;
    if (lazy[node] != 0) {
      trenode[node] += lazy[node];
      if (l != r) {
        lazy[node * 2] += lazy[node];
        lazy[node * 2 + 1] += lazy[node];
      }
      lazy[node] = 0;
    }
    if (l >= i && r <= j) return trenode[node];
    long long p1 = get(i, j, l, (l + r) / 2, node * 2);
    long long p2 = get(i, j, (l + r) / 2 + 1, r, node * 2 + 1);
    return p1 + p2;
  }
};
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a;
    cin >> a;
    string s;
    cin >> s;
    int d1 = -1, d2 = -1;
    if (s[0] == '<' && s[a - 1] == '>')
      cout << "1\n";
    else
      cout << "0\n";
  }
}
