#include <bits/stdc++.h>
int k;
int wordlen[500000];
int iwordcont;
int minwidth;
bool bokfun(int x) {
  bool bRet = true;
  int a = 0;
  int cx = 0;
  int i = 0;
  for (i = 0; i < iwordcont; i++) {
    cx += wordlen[i];
    if (cx > x) {
      a++;
      if (a >= k) {
        bRet = false;
        break;
      }
      cx = wordlen[i];
    }
  }
  return bRet;
}
int main() {
  scanf("%d", &k);
  getchar();
  int ilen = 0;
  int wordlenmax;
  char ch;
  int x = 0;
  while (ch = getchar()) {
    if (ch == EOF || ch == '\r' || ch == '\n') {
      wordlen[iwordcont++] = x;
      if (wordlenmax < x) wordlenmax = x;
      break;
    }
    x++;
    if (ch == '-' || ch == ' ') {
      wordlen[iwordcont++] = x;
      if (wordlenmax < x) wordlenmax = x;
      x = 0;
    }
    ilen++;
  }
  do {
    if (k == 1) {
      minwidth = ilen;
      break;
    }
    if (iwordcont <= k) {
      minwidth = wordlenmax;
      break;
    }
    int a = (ilen % k == 0) ? (ilen / k) : (ilen / k + 1);
    int imin = a > wordlenmax ? a : wordlenmax;
    for (int i = imin; i < ilen; i++) {
      if (bokfun(i)) {
        minwidth = i;
        break;
      }
    }
  } while (false);
  printf("%d", minwidth);
  return 0;
}
