#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e6 + 7;
int read() {
  int x = 0, f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
int k, len;
int pos[Maxn];
char s[Maxn];
bool check(int x) {
  int tmp = 0, zk = 0;
  int i = 1;
  while (1) {
    if (i == len + 1) {
      if (tmp) zk++;
      break;
    }
    if (tmp + pos[i] - i + 1 > x) {
      tmp = 0;
      zk++;
      continue;
    }
    tmp += pos[i] - i + 1;
    i = pos[i] + 1;
  }
  return zk <= k;
}
int main() {
  k = read();
  gets(s + 1);
  len = strlen(s + 1);
  pos[len] = len;
  for (int i = len - 1; i >= 1; i--) {
    if (s[i] == '-' || s[i] == ' ')
      pos[i] = i;
    else
      pos[i] = pos[i + 1];
  }
  int l = 1, r = 1e6, ans;
  for (int i = 1; i <= len; i++) l = max(l, pos[i] - i + 1);
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%d\n", ans);
}
