#include <bits/stdc++.h>
using namespace std;
int k;
vector<string> V;
bool test(int x) {
  int level = 0;
  int cur = 0;
  for (int i = 0; i < V.size(); i++) {
    if (cur + V[i].length() <= x) {
      cur += V[i].length();
    } else {
      level++;
      cur = V[i].length();
      if (level >= k) {
        return false;
      }
      if (cur > x) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> k;
  cin.ignore();
  string s;
  getline(cin, s);
  string tmp;
  for (int i = 0; i < s.length(); i++) {
    tmp += s[i];
    if (s[i] == ' ' || s[i] == '-') {
      V.push_back(tmp);
      tmp = "";
    }
  }
  if (tmp != "") {
    V.push_back(tmp);
  }
  int l = 1, r = s.length();
  int mid;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (!test(mid)) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  cout << l;
}
