#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1000005;
int k, n, cur, a[N], cnt = 0, small = 0;
char str[N];
bool check(int len) {
  int num = 0, sum = 0;
  for (int i = 1; i <= cnt; i++) {
    if (sum + a[i] > len) {
      num++;
      sum = 0;
    }
    sum += a[i];
  }
  if (sum != 0) num++;
  if (num <= k) return true;
  return false;
}
int main() {
  scanf("%d\n", &k);
  gets(str);
  cur = -1;
  n = strlen(str);
  for (int i = 0; i < n; i++) {
    if (str[i] == '-' || str[i] == ' ' || i == n - 1) {
      a[++cnt] = i - cur;
      cur = i;
      small = max(small, a[cnt]);
    }
  }
  int l = small, r = n, mid = (small + n) / 2;
  while (l < r) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (mid > small && check(mid - 1))
    mid--;
  else if (mid > small + 1 && check(mid - 2))
    mid -= 2;
  else if (!check(mid))
    mid++;
  printf("%d", mid);
  return 0;
}
