Example

Input

7
>>


Output

7
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n;string s;
  cin>>n>>s;

  int ans = 0;
  rep(_,2){
    vector<int> l(n,0),r(n,0);
    rep(i,n){
      if(s[i]=='>') r[i]++;
      if(i>0) r[i] += r[i-1];
    }
    for(int i=n-1; i>=0; i--){
      if(s[i]=='<') l[i]--;
      if(i<=n-2) l[i] += l[i+1];
    }
    rep(i,n){
      if(s[i]=='>'){
        if(r[i] == -l[i]){
          int idx = lower_bound(all(l), 0) - l.begin();
          ans = max(ans, idx);//dbg(i,idx);
        }
        else if(r[i] < -l[i]){
          int x = l[i] + r[i] -1;
          int idx = upper_bound(all(l), x) - l.begin();
          idx--;
          ans = max(ans, idx+1);//dbg(i,idx+1);
        }
        else {
          int x = l[i]+r[i];
          int idx = lower_bound(all(r), x) - r.begin();
          ans = max(ans, n - idx);// dbg(i,n-idx);
        }
      }
    }
    reverse(all(s));
    rep(i,n){
      if(s[i]=='>') s[i]='<';
      else s[i]='>';
    }
  }
  cout << ans << endl;

  return 0;
}