#include <bits/stdc++.h>
using namespace std;
vector<int> len;
string s;
int k, cnt, l, r, ans = INT_MAX;
int main() {
  cin >> k;
  getline(cin, s);
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    cnt++;
    if (s[i] == ' ' || s[i] == '-') {
      len.push_back(cnt);
      l = max(l, cnt);
      r += cnt;
      cnt = 0;
    }
  }
  len.push_back(cnt);
  l = max(l, cnt);
  r += cnt;
  while (l <= r) {
    int mid = (l + r) / 2, sum = 0, cot = 0;
    for (int i = 0; i < len.size(); i++) {
      sum += len[i];
      if (sum > mid) {
        sum = len[i];
        cot++;
      }
    }
    if (sum > 0) cot++;
    if (cot <= k) ans = min(ans, mid);
    if (cot > k) l = mid + 1;
    if (cot <= k) r = mid - 1;
  }
  cout << ans;
  return 0;
}
