Example

Input

7
>>


Output

7
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

bool isleft(string s, int m){
	int n = s.length();
	int x = 0, y = 0;
	REP(i,m) if (s[i] == '>') x++;
	FOR(i,m+1,n-1) if (s[i] == '<') y++;
	if (s[m] == '>') return y > x;
	else return y >= x;
}

int calc(string s, int m){
	int n = s.length();
	int res1 = 0, res2 = 0;
	if (m >= 0){
		int x = 0;
		REP(i,m+1) if (s[i] == '>') x++;
		int y = 0;
		if (s[m] == '<') y = -1;
		for (int i = m; y < x; i++){
			if (s[i] == '<') y++;
			if (y >= x){
				res1 = i+1;
				break;
			}
		}
	}
	m++;
	if (m < n){
		int x = 0;
		FORR(i,n-1,m) if(s[i] == '<') x++;
		int y = 0;
		if (s[m] == '>') y = -1;
		for (int i = m; y < x; i--){
			if (s[i] == '>') y++;
			if (y >= x){
				res2 = n-i;
				break;
			}
		}
	}

	return max(res1, res2);
}

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

	int l = -1, r = n;
	while (r - l > 1){
		int m = (l+r)/2;
		if (isleft(s, m)) l = m;
		else r = m;
	}

	cout << calc(s, l) << endl;

    return 0;
}