#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int x;
  cin >> x;
  while (x--) {
    long long int n, i, j, k, c = 0, d = 0, e = 0, p, q, x;
    long long int flag = 0, cnt1 = 0, cnt2 = 0;
    long long int ans1 = 0, ans2 = 0;
    vector<long long int> v;
    vector<long long int> v1;
    vector<long long int> v2;
    vector<pair<long long int, long long int> > v3;
    cin >> n;
    string s;
    cin >> s;
    if (n == 1) {
      cout << "0" << endl;
    } else {
      for (i = 0; i < n; i++) {
        if (s[i] == '<') {
          c++;
          flag = 1;
        }
        if (s[i] == '>' && flag == 0) {
          ans1 = 0;
          break;
        }
        if (s[i] == '>' && flag == 1) {
          ans1 = 1;
          break;
        }
      }
      flag = 0;
      for (i = n - 1; i >= 0; i--) {
        if (s[i] == '>') {
          d++;
          flag = 1;
        }
        if (s[i] == '<' && flag == 0) {
          ans2 = 0;
          break;
        }
        if (s[i] == '<' && flag == 1) {
          ans2 = 1;
          break;
        }
      }
      if (c == n || d == n) {
        cout << "0" << endl;
      } else {
        cout << min(ans1, ans2) << endl;
      }
    }
  }
  return 0;
}
