#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int k;
  cin >> k;
  cin.get();
  string s;
  getline(cin, s);
  vector<int> b;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == ' ' or s[i] == '-') {
      b.emplace_back(i);
    }
  }
  auto get = [&](int w) {
    if (b.empty()) {
      if (s.length() > w) {
        return false;
      } else {
        return true;
      }
    }
    if (b[0] + 1 > w) return false;
    for (int i = 1; i < b.size(); i++) {
      if (b[i] - b[i - 1] > w) {
        return false;
      }
    }
    if (s.length() - b.back() - 1 > w) {
      return false;
    }
    int cl = 1, cb = -1;
    for (int i = 0; i < b.size(); i++) {
      if (b[i] - cb > w) {
        cb = b[i - 1];
        cl++;
      } else if (b[i] - cb == w) {
        cb = b[i];
        cl++;
      }
    }
    if (s.length() - 1 - cb > w) cl++;
    return (cl <= k);
  };
  int lo = 1, hi = s.length();
  while (lo < hi) {
    int md = (lo + hi) / 2;
    if (get(md))
      hi = md;
    else
      lo = md + 1;
  }
  cout << lo << '\n';
}
