#include <bits/stdc++.h>
using namespace std;
int k, t_len;
string t;
bool can(int mid) {
  int last_sep = -1, cur_len = 0, num_lines = 1;
  for (int i = 0; i < t_len; i++) {
    cur_len++;
    if (cur_len > mid) {
      num_lines++;
      if (last_sep == -1) return false;
      cur_len = i - last_sep;
      if (cur_len > mid) return false;
      last_sep = -1;
    }
    if (t[i] == '-' || t[i] == ' ') last_sep = i;
  }
  return num_lines <= k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> k;
  for (int i = 0; i < 2; i++) getline(cin, t, '\n');
  t_len = t.length();
  if (k == 1) {
    cout << t_len << endl;
    return 0;
  }
  int lo = 1, hi = t_len, mid;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    if (can(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  if (can(lo))
    cout << lo << endl;
  else
    cout << hi << endl;
  return 0;
}
