#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<string> text;
vector<int> lens;
bool check(int w) {
  int c = 0, lines = 1;
  for (int i = 0; i < (int)(lens).size(); i++) {
    if (lens[i] > w) return false;
    if (c + lens[i] > w) {
      lines++;
      i--;
      c = 0;
    } else
      c += lens[i];
  }
  return lines <= n;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  while (cin >> s) text.push_back(s);
  int c;
  for (int i = 0; i < (int)(text).size(); i++) {
    c = 0;
    for (int j = 0; j < (int)(text[i]).size(); j++) {
      c++;
      if (text[i][j] == ' ' || text[i][j] == '-') {
        lens.push_back(c);
        c = 0;
      }
    }
    if (c) {
      if (i != (int)(text).size() - 1)
        lens.push_back(c + 1);
      else
        lens.push_back(c);
    }
  }
  int s = 0, e = 1e9, mid;
  while (e - s > 1) {
    mid = (s + e) >> 1;
    if (check(mid))
      e = mid;
    else
      s = mid;
  }
  cout << e << '\n';
  return 0;
}
