Example

Input

7
>>


Output

7
#include<bits/stdc++.h>
#define INF (1e9)
#define N 100005
using namespace std;
string s;
int n,l=INF,r=0,L[N],R[N];

int main(){
  cin>>n>>s;
  s='x'+s;
  for(int i=1;i<s.size();i++){
    if(s[i]=='>')l=min(l,i);
    else r=max(r,i);
  }
  for(int i=1;i<s.size();i++){
    if(s[i]=='>')L[i]+=L[i-1]+1;
    else L[i]+=L[i-1];
  }
  for(int i=s.size()-1;i>=1;i--){
    if(s[i]=='<')R[i]+=R[i+1]+1;
    else R[i]+=R[i+1];
  }
  int ans=0;
  for(int i=1;i<s.size();i++){
    if(!L[i-1]&&!R[i+1])
      if(s[i]=='>')ans=max(ans,(int)s.size()-i);
      else ans=max(ans,i);
    else if(L[i-1]-R[i+1]==1&&s[i]=='<')
      ans=max(ans,(int)s.size()-l);
    else if(R[i+1]-L[i-1]==1&&s[i]=='>')
      ans=max(ans,r);
    else if(L[i-1]==R[i+1]){
      if(s[i]=='>')
	ans=max(ans,(int)s.size()-l);
      else ans=max(ans,r);
    }
  }
  cout<<ans<<endl;
  return 0;
}