import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();

        for(; q>0; q--){
            int n = in.nextInt();
            char a[] = in.next().toCharArray();
            boolean ans = true;
            for(int i = 0; i<n-1 && ans; i++){
                if(a[i]=='<' && a[i+1]=='>') ans = false;
            }
            System.out.println(ans?0:1);
        }

    }

}