#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll inf = 1;
const ll mod = 1E9;
char s[1000010];
int main() {
  ios::sync_with_stdio(false);
  int k;
  scanf("%d %[^\n]", &k, s);
  int n = strlen(s);
  vector<int> closestLest(n + 2, 0);
  int pre = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == ' ' || s[i] == '-') pre = i + 1;
    closestLest[i + 1] = pre;
  }
  closestLest[n] = n;
  int lo = 1, hi = n, ans;
  while (lo <= hi) {
    int mid = (lo + hi) >> 1;
    bool flag = false;
    int pre = 0;
    for (int i = 0; i < k; i++) {
      int now = closestLest[min(pre + mid, n)];
      if (now <= pre) break;
      if (now == n) {
        flag = true;
        break;
      }
      pre = now;
    }
    if (flag) {
      ans = mid;
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
