Example

Input

7
>>


Output

7
#include<bits/stdc++.h>
#define MAX 200010
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int main()
{
  int n;
  int l[MAX],r[MAX];
  map<int,int> L,R;
  string s;

  cin>>n>>s;

  FOR(i,0,n)if(s[i]=='>')l[i]++;
  RFOR(i,n,0)if(s[i]=='<')r[i]++;
  FOR(i,1,n)l[i]+=l[i-1];
  RFOR(i,n,1)r[i-1]+=r[i];
  FOR(i,0,n){
    if(s[i]=='>')l[i]--;
    else r[i]--;
  }
  FOR(i,0,n)L[l[i]]=i;
  RFOR(i,n,0)R[r[i]]=i;
 
  int ans=0;
  FOR(i,0,n){
    if(s[i]=='>'){
      if(l[i]<r[i])ans=max(ans,R[r[i]-l[i]-1]+1);
      else ans=max(ans,n-L[l[i]-r[i]]);
    }
    else {
      if(l[i]<=r[i])ans=max(ans,R[r[i]-l[i]]+1);
      else ans=max(ans,n-L[l[i]-r[i]-1]);
    }
  }
  cout<<ans<<endl;
  return 0;
}