#include<bits/stdc++.h>
using namespace std;
/*********ANISH***********ANISH*************ANISH***********ANISH******/
#define pb push_back
#define ll long long
#define ff first
#define ss second
ll max(ll a,ll b)
{
    if(a>b) return a;
    return b;
}
ll min(ll a,ll b)
{
    if(a<b) return a;
    return b;
}
ll lcm(ll a, ll b)  
{  
    return (a*b)/__gcd(a, b);  
}  
/********ANISH************ANISH*************ANISH**********ANISH*********/
string smiley=":(";
int main()
{
  int test;
  cin>>test;
  while(test--)
  {
    int n;
    cin>>n;
    string s;
    cin>>s;
    bool less=0,greater=0;
    for(int i=0;i<n&&s[i]!='>';++i)
     less=true;
    for(int i=n-1;i>=0&&s[i]!='<';--i) greater=true;
    if(less&greater) cout<<1;
    else cout<<0;
    cout<<"\n";
  }
}