#include <bits/stdc++.h>
using namespace std;
int d[1000050], n, m, magx, s = 1 << 30, e, idx, cnt, k;
int main() {
  scanf("%d", &k);
  string str;
  cin.ignore();
  getline(cin, str);
  int slen = str.length();
  for (int i = 0; i < slen; i++) {
    cnt++;
    if (str[i] == '-' || str[i] == ' ' || i == slen - 1) {
      d[idx] = cnt;
      cnt = 0;
      idx++;
    }
  }
  n = idx, m = min(n, k);
  for (int i = 0; i < n; i++) {
    magx = max(magx, d[i]);
    e += d[i];
    s = min(s, d[i]);
  }
  while (s < e) {
    int med = (s + e) / 2, cr = 1, sum = 0;
    for (int i = 0; i < n; i++) {
      if (sum + d[i] > med) {
        sum = d[i];
        cr++;
      } else
        sum += d[i];
    }
    if (cr > m)
      s = med + 1;
    else
      e = med;
  }
  printf("%d", max(s, magx));
}
