#include <bits/stdc++.h>
using namespace std;
bool fits(string &s, int len, int k) {
  int last_break = -1, pos_break = -1, window = len - 1;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == ' ' || s.at(i) == '-') {
      pos_break = i;
    }
    if (i >= window && i != s.size() - 1) {
      last_break = pos_break;
      window = last_break + len;
      if (i >= window) {
        return false;
      }
      k--;
    }
  }
  k--;
  return k >= 0;
}
bool fits(vector<int> &vec, int len, int k) {
  int last = -1, inc = len;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] > len) {
      if (last == -1) {
        return false;
      }
      len = inc + last;
      if (vec[i] > len) {
        return false;
      }
      k--;
    }
    last = vec[i];
  }
  k--;
  return k >= 0;
}
int main() {
  int l, r, k, m, sol;
  string s;
  vector<int> pb;
  cin >> k;
  cin.ignore();
  getline(cin, s);
  l = 1;
  r = s.size();
  while (l <= r) {
    m = l + (r - l) / 2;
    if (fits(s, m, k)) {
      sol = m;
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  cout << sol << endl;
}
