#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 2 ? a : gcd(b, a % b); };
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  while (n--) {
    int t;
    string s;
    cin >> t >> s;
    if (s[0] == '>' || s[t - 1] == '<') {
      cout << 0 << endl;
      continue;
    }
    cout << 1 << endl;
  }
};
