#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int v[1000010];
int main() {
  int k;
  scanf("%d", &k);
  getchar();
  gets(s);
  int len = strlen(s);
  int p = -1, l = 0;
  int le = 0, ri = len;
  for (int i = 0; i < len; i++) {
    if (s[i] == ' ' || s[i] == '-') {
      v[l++] = i - p;
      p = i;
      le = max(le, v[l - 1]);
    }
  }
  v[l++] = len - p - 1;
  le = max(le, v[l - 1]);
  while (le < ri) {
    int mid = (le + ri) / 2;
    p = 0;
    int cnt = 0;
    for (int i = 0; i < l; i++) {
      if (p + v[i] <= mid)
        p += v[i];
      else {
        cnt++;
        p = v[i];
      }
    }
    if (p) cnt++;
    if (cnt > k)
      le = mid + 1;
    else
      ri = mid;
  }
  printf("%d\n", le);
  return 0;
}
