#include <bits/stdc++.h>
using namespace std;
long long k;
vector<long long> vec;
bool valid(long long y) {
  long long c = 0;
  long long temp = -1;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] > y) return false;
    if (temp == -1)
      temp = vec[i];
    else
      temp += vec[i];
    if (temp > y) {
      temp -= vec[i];
      c++;
      temp = vec[i];
    }
    if (c > k) return false;
  }
  c++;
  if (c > k) return false;
  return true;
}
int main() {
  cin >> k;
  string s;
  getline(cin, s);
  getline(cin, s);
  long long t = 0;
  for (int i = 0; i < s.size(); i++) {
    t++;
    if (s[i] != ' ' && s[i] != '-') continue;
    vec.push_back(t);
    t = 0;
  }
  if (t != 0) vec.push_back(t);
  long long ans = 0;
  long long l = 0, r = 1000000;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (valid(mid)) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  cout << ans << "\n";
}
