#include <bits/stdc++.h>
using namespace std;
int f(vector<int> &v, int mi, int &k) {
  int cnt = 0;
  int n = (int)v.size();
  int posi = 0;
  int p = -1;
  while ((posi != v[n - 1] + 1)) {
    int q = p;
    while (1) {
      if (p + 1 < n && v[p + 1] - posi + 1 <= mi) {
        p++;
      } else
        break;
    }
    if (q == p) return 0;
    if (p == -1 || v[p] - posi + 1 > mi) return 0;
    cnt++;
    posi = v[p] + 1;
  }
  return cnt <= k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int k;
  string ss;
  getline(cin, ss);
  stringstream is(ss);
  is >> k;
  string s;
  getline(cin, s);
  vector<int> v;
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] == ' ' || s[i] == '-') {
      v.push_back(i);
    }
  }
  v.push_back((int)s.size() - 1);
  int pos;
  int lo = 0, hi = 1e6, mi;
  while (hi - lo > 1) {
    mi = (lo + hi) / 2;
    if (f(v, mi, k))
      hi = mi;
    else
      lo = mi;
  }
  cout << hi << '\n';
}
