#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 5;
char str[MAXN];
int len;
bool check(int mid) {
  int index = 0;
  int j, i;
  for (i = 0; i < len; i++) {
    int item = 0;
    for (j = index; j < index + mid && j < strlen(str); j++) {
      if (str[j] == ' ' || str[j] == '-') {
        item = j;
      }
    }
    if (j == strlen(str)) return true;
    if (item == 0) return false;
    index = item + 1;
  }
  return false;
}
int main() {
  scanf("%d", &len);
  getchar();
  cin.getline(str, 10000000, '\n');
  int down = 0, up = strlen(str);
  while (down <= up) {
    int mid = (down + up) >> 1;
    if (check(mid))
      up = mid - 1;
    else
      down = mid + 1;
  }
  printf("%d\n", down);
  return 0;
}
