#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
char s[MAXN];
int n, k, a[MAXN];
int ju(int x) {
  int s = 0, c = 1;
  for (int i = 0; i < n; ++i) {
    if (s + a[i] <= x)
      s += a[i];
    else
      s = a[i], c++;
  }
  return c <= k;
}
int main() {
  scanf("%d\n", &k);
  gets(s);
  int c = 0, lb = 0, ub = MAXN;
  for (int i = 0; s[i]; ++i) {
    if (s[i] == ' ' || s[i] == '-')
      a[n++] = c, c = 0;
    else
      c++;
  }
  a[n++] = lb = c;
  for (int i = 0; i < n - 1; ++i) lb = max(lb, ++a[i]);
  lb--;
  for (int m; lb + 1 < ub; (ju(m = (lb + ub) >> 1) ? ub : lb) = m)
    ;
  printf("%d\n", ub);
  return 0;
}
