#include <bits/stdc++.h>
using namespace std;
string s;
int k;
int calc(int w) {
  int br = -1, lb = -1, cnt = 1;
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    if (c == ' ' || c == '-') lb = i;
    if (i - br == w && i != s.size() - 1) {
      if (lb == br) return 0;
      br = lb;
      cnt++;
    }
  }
  return cnt <= k;
}
int main() {
  cin >> k;
  getline(cin, s);
  getline(cin, s);
  int lo = 0, hi = s.size();
  while (lo + 1 < hi) {
    int mid = (lo + hi) / 2;
    if (calc(mid))
      hi = mid;
    else
      lo = mid;
  }
  cout << hi << endl;
  return 0;
}
