#include <bits/stdc++.h>
using namespace std;
int k;
char s[1001000];
int ll;
int ok(int aa) {
  int pos = 0, cnt = 0, line = 1;
  while (true) {
    int pos2 = pos;
    while (pos2 < ll && s[pos2] != '-') pos2++;
    if (pos2 == ll) {
      if (cnt + pos2 - pos <= aa)
        return 1;
      else {
        if (pos2 - pos <= aa && line + 1 <= k)
          return 1;
        else
          return 0;
      }
    } else {
      if (cnt + pos2 - pos + 1 == aa) {
        cnt = 0;
        line++;
      } else if (cnt + pos2 - pos + 1 > aa) {
        cnt = pos2 - pos + 1;
        if (cnt > aa) return 0;
        line++;
      } else {
        cnt += pos2 - pos + 1;
      }
      pos = pos2 + 1;
      if (line > k) return 0;
    }
  }
}
int main() {
  scanf("%d", &k);
  gets(s);
  gets(s);
  ll = strlen(s);
  for (int i = 0; i < ll; i++)
    if (s[i] == ' ') s[i] = '-';
  int left = 1, right = ll + 1, ans = -1;
  while (left <= right) {
    int mid = (left + right) / 2;
    if (ok(mid))
      ans = mid, right = mid - 1;
    else
      left = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
