#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(6);
  long long t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 1, ans_1 = 1;
    if (s[0] == '>') ans = 0;
    if (s[s.length() - 1] == '<') ans_1 = 0;
    cout << min(ans_1, ans) << "\n";
  }
}
