#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17L;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 5;
const int Mod = 1e9 + 7;
int pos[maxn], tot, k;
bool judge(int limit) {
  int num = 0, i = 1, pre = 0;
  while (i <= tot) {
    while (i <= tot && pos[i] - pos[pre] <= limit) i++;
    if (i == pre + 1) return false;
    num++;
    pre = i - 1;
  }
  if (num <= k) return true;
  return false;
}
int main() {
  scanf("%d", &k);
  getchar();
  for (int i = 1; 1; i++) {
    char c = getchar();
    if (c == ' ' || c == '-')
      pos[++tot] = i;
    else if (c == '\n') {
      pos[++tot] = i - 1;
      break;
    }
  }
  int l = 1, r = 1e6, ans = 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (judge(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
