#include <bits/stdc++.h>
using namespace std;
int k, n, a[1001001], s[1001001];
char txt[1001001];
bool ok(int mx) {
  for (int i = 1, r = k; i <= n && r; i++, r--) {
    int j = lower_bound(s + i, s + n + 1, s[i - 1] + mx + 1) - s - 1;
    if (j < i) return 0;
    if (j == n) return 1;
    i = j;
  }
  return 0;
}
int main() {
  scanf("%d\n", &k);
  gets(txt);
  int len = strlen(txt);
  if (len == 1) return puts("1"), 0;
  for (int i = 0, j = 0; i < len; i++) {
    if (txt[i] == ' ' || txt[i] == '-') a[++n] = i - j + 1, j = i + 1;
    if (i == len - 1) a[++n] = len - j;
  }
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];
  int st = 1, en = len;
  while (en - st > 1) {
    int mid = st + en >> 1;
    if (ok(mid))
      en = mid;
    else
      st = mid;
  }
  printf("%d\n", en);
  return 0;
}
