#include <bits/stdc++.h>
using namespace std;
vector<int> v;
bool check(int m, int k, string &s) {
  int last = -1, t = 1;
  bool f = 1;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] - last > m) {
      if (i == 0 || v[i] - v[i - 1] > m) {
        return 0;
      }
      last = v[i - 1];
      t++;
    }
    if (last != v[i] && i == int(v.size()) - 1 && s.size() - (last + 1) > m) {
      last = v[i];
      t++;
    }
  }
  if (s.size() - (last + 1) > m) {
    f = 0;
  }
  return t <= k && f;
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  int k;
  string s;
  cin >> k;
  getline(cin, s);
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ' || s[i] == '-') v.push_back(i);
  }
  int l = 0, r = s.size();
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m, k, s))
      r = m;
    else
      l = m;
  }
  cout << r;
  return 0;
}
