#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (s == "<>")
    cout << 1 << '\n';
  else if (s[0] == '>' || s.back() == '<' || s.size() == 1)
    cout << 0 << '\n';
  else
    cout << 2 << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) solve();
}
