#include <bits/stdc++.h>
int main() {
  int a, ans = 1000000, count;
  scanf("%d", &a);
  char s[a], r[a];
  scanf("%s", s);
  for (int i = 0; r[i] != '\0'; i++) r[i] = '.';
  int len = strlen(s);
  for (int i = 0; i < len + 1; i++) {
    count = 0;
    for (int j = 0; s[j] != '\0'; j++) {
      if (r[j] != s[j]) count++;
    }
    ans = fmin(ans, count);
    r[a - i] = '#';
  }
  printf("%d\n", a - ans);
}
