#include <bits/stdc++.h>
using namespace std;
int k, n;
string s;
vector<int> v;
bool check(int len) {
  int cnt = 0, _cnt = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] > len) return 0;
    if (cnt + v[i] > len) {
      _cnt++;
      cnt = 0;
    }
    cnt += v[i];
  }
  if (cnt > 0) {
    _cnt++;
  }
  return _cnt <= k;
}
int main(void) {
  cin >> k;
  getline(cin, s);
  getline(cin, s);
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    cnt++;
    if (s[i] == '-' || s[i] == ' ' || i == s.size() - 1) {
      v.push_back(cnt);
      cnt = 0;
    }
  }
  n = v.size();
  if (k == n) {
    sort(v.begin(), v.begin() + n);
    reverse(v.begin(), v.begin() + n);
    cout << v[0];
    return 0;
  }
  if (n == 1 || k == 1) {
    cout << s.size();
    return 0;
  }
  int left = 1, right = 1e6;
  while (left < right - 1) {
    int mid = (left + right) / 2;
    if (check(mid))
      right = mid;
    else
      left = mid;
  }
  if (check(left))
    cout << left;
  else
    cout << right;
  return 0;
}
