Example

Input

7
>>


Output

7
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int n;
string s;
int sz;
int cumL[100010], cumR[100010];
int posL[100010], posR[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> n >> s;
  sz = s.size();
  int tmp = 0;
  for (int i = 0; i < sz; i++) {
    if (i) cumL[i] = cumL[i - 1];
    if (s[i] == '>') {
      cumL[i]++;
      posL[tmp++] = i;
    }
  }
  tmp = 0;
  for (int i = sz - 1; i >= 0; i--) {
    if (i + 1 < sz) cumR[i] = cumR[i + 1];
    if (s[i] == '<') {
      cumR[i]++;
      posR[tmp++] = i;
    }
  }

  int ans = 0;
  for (int i = 0; i < sz; i++) {
    if (s[i] == '>') {
      if (cumL[i] <= cumR[i]) {
        ans = max(ans, posR[cumR[i] - cumL[i]] + 1);
      } else {
        ans = max(ans, n - posL[cumL[i] - cumR[i] - 1]);
      }
    } else {
      if (cumL[i] >= cumR[i]) {
        ans = max(ans, n - posL[cumL[i] - cumR[i]]);
      } else {
        ans = max(ans, posR[cumR[i] - cumL[i] - 1] + 1);
      }
    }
  }
  cout << ans << endl;

  return 0;
}
