#include <bits/stdc++.h>
using namespace std;
char s[1234567];
int a[123456];
int ok(int m, int k) {
  int cnt = 0;
  int n = strlen(s);
  memset(a, 0, sizeof(a));
  int b = 0;
  for (int i = 0; i <= n; i++) {
    if (i == n || s[i] == ' ' || s[i] == '-') {
      if (i != n) b++;
      if (b > m) return 0;
      if (b + a[cnt] > m) cnt++;
      a[cnt] += b;
      b = 0;
    } else
      b++;
  }
  if (cnt < k)
    return 1;
  else
    return 0;
}
int main() {
  int k, cnt = 0;
  scanf("%d", &k);
  getchar();
  gets(s);
  int n = strlen(s);
  int l = 1, r = n;
  int ans = 0;
  while (l <= r) {
    cnt = 0;
    int m = (l + r + 1) / 2;
    if (ok(m, k) == 1) {
      ans = m;
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
