#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
char str[maxn];
int n, t = 1;
int a[maxn], b[maxn];
int search(int x) {
  int cnt = 0;
  int res = 0;
  for (int i = 1; i <= t; i++) {
    if (res + b[i] <= x) {
      res += b[i];
    } else {
      cnt++;
      res = 0;
      i--;
    }
  }
  if (cnt >= n)
    return 0;
  else
    return 1;
}
int main() {
  char str[maxn];
  scanf("%d", &n);
  getchar();
  gets(str);
  int len = strlen(str);
  for (int i = 0; i < len; i++) {
    if (str[i] == '-' || str[i] == ' ') {
      a[t] = i;
      t++;
    }
  }
  a[t] = len - 1;
  b[1] = a[1] + 1;
  for (int i = 2; i <= t; i++) {
    b[i] = a[i] - a[i - 1];
  }
  if (t <= n) {
    sort(b + 1, b + 1 + t);
    printf("%d", b[t]);
  } else {
    int l = b[1], r = a[t] + 1;
    while (l < r) {
      int mid = (l + r) / 2;
      if (search(mid))
        r = mid;
      else
        l = mid + 1;
    }
    printf("%d", l);
  }
}
