#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  list<char> l;
  char c;
  cin >> c;
  l.push_back(c);
  for (int i = 1; i < n; i++) {
    cin >> c;
    if (l.back() != '>' || (l.back() == '<' && c == '>')) {
      l.push_back(c);
    }
  }
  int ans = l.size();
  if (ans == 1 || ans == 0)
    cout << 0 << endl;
  else if (ans >= 2)
    cout << 1 << endl;
  return;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
