#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
const long long MAX_SIZE = 1000001;
vector<long long> isprime(MAX_SIZE, true);
vector<long long> prime;
vector<long long> SPF(MAX_SIZE);
void manipulated_seive(int N) {
  isprime[0] = isprime[1] = false;
  for (long long int i = 2; i < N; i++) {
    if (isprime[i]) {
      prime.push_back(i);
      SPF[i] = i;
    }
    for (long long int j = 0;
         j < (int)prime.size() && i * prime[j] < N && prime[j] <= SPF[i]; j++) {
      isprime[i * prime[j]] = false;
      SPF[i * prime[j]] = prime[j];
    }
  }
}
int main() {
  long long i, j, k, n, m;
  string s;
  long long co = 0, mx = 0;
  cin >> m;
  while (m--) {
    cin >> n;
    cin >> s;
    long long flag = 0;
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '<' && s[i + 1] == '>') {
        flag = 1;
        break;
      }
    }
    if (flag == 1)
      cout << 1 << "\n";
    else
      cout << 0 << "\n";
  }
  return 0;
}
