#include <bits/stdc++.h>
using namespace std;
int k, l, ln, maxx;
char s[1000000];
int a[1010000], cnt, sm;
inline void read(int& x) {
  char c = getchar();
  x = 0;
  while (c > '9' || c < '0') c = getchar();
  while (c <= '9' && c >= '0') x = (x << 1) + (x << 3) + c - '0', c = getchar();
}
inline bool check(int x) {
  int len = -1, points = 1;
  for (int i = 1; i <= cnt; i++) {
    if (a[i] - len > x) {
      i--;
      points++;
      len = a[i];
    }
    if (points > k) return false;
  }
  return true;
}
int main() {
  cin >> k;
  getchar();
  gets(s);
  l = strlen(s);
  a[0] = -1;
  for (int i = 0; i < l; i++) {
    if (s[i] == ' ' || s[i] == '-') {
      ++cnt;
      a[cnt] = i;
      maxx = max(i, a[cnt] - a[cnt - 1]);
    }
  }
  a[++cnt] = l - 1;
  int ls = 1, r = l, mid = (l + maxx) >> 1;
  while (ls < r) {
    mid = (ls + r) >> 1;
    if (check(mid))
      r = mid;
    else
      ls = mid + 1;
  }
  printf("%d", ls);
}
