#include <bits/stdc++.h>
using namespace std;
bool wrap(const string& s, size_t width, size_t k) {
  for (size_t init = 0, lines = 1, line_start = 0; init < s.size();) {
    auto next = s.find_first_of("- ", init);
    if (next > s.size()) next = s.size() - 1;
    if (next + 1 - line_start > width) {
      lines++;
      if (lines > k) return false;
      line_start = init;
    } else
      init = next + 1;
  }
  return true;
}
size_t minv = numeric_limits<size_t>::max();
bool bs(size_t from, size_t to, const string& s, size_t k) {
  if (from == to) return false;
  auto mid = (from + to) / 2;
  if (wrap(s, mid, k)) {
    if (mid < minv) minv = mid;
    return bs(from, mid, s, k);
  } else {
    return bs(mid + 1, to, s, k);
  }
}
int main() {
  size_t k;
  cin >> k;
  char skip;
  cin >> noskipws >> skip >> skipws;
  string s;
  getline(cin, s);
  auto size = s.size();
  bs(0, size + 1, s, k);
  cout << minv << '\n';
  return 0;
}
