#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;
int k;
int minWidth() {
  string line;
  getline(cin, line);
  replace(line.begin(), line.end(), '-', ' ');
  VI width;
  istringstream toks(line);
  string token;
  while (toks >> token) width.push_back((int)token.size() + 1);
  if (width.empty()) return 0;
  --width.back();
  int lo = *max_element(width.begin(), width.end()) - 1;
  int hi = accumulate(width.begin(), width.end(), 0);
  while (lo + 1 < hi) {
    int mid = (lo + hi) / 2;
    int row = 0, col = 0;
    for (int v : width) {
      if (col + v > mid) ++row, col = 0;
      col += v;
    }
    if (col) ++row;
    if (row > k)
      lo = mid;
    else
      hi = mid;
  }
  return hi;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> k >> ws;
  cout << minWidth() << endl;
  return 0;
}
