#include <bits/stdc++.h>
const int MAX = 1e6 + 3;
long long INF = LLONG_MAX;
const long long MOD = 1e9 + 7;
const double PI = acos(-1);
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s.size() == 2 && s[0] == '<' && s[1] == '>') {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
  return 0;
}
