#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> mp;
int check(int k) {
  int cnt = 1, tmp = 0;
  for (int i = 0; i < mp.size(); i++) {
    if (mp[i] > k) return 0;
    if (tmp + mp[i] > k) {
      cnt++;
      tmp = mp[i];
    } else {
      tmp += mp[i];
    }
  }
  return cnt <= n;
}
int main() {
  cin >> n;
  getchar();
  string s;
  getline(cin, s);
  string s1 = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ' || s[i] == '-') {
      s1 += ' ';
      mp.push_back(s1.size());
      s1 = "";
    } else
      s1 += s[i];
  }
  mp.push_back(s1.size());
  int l = 1, r = 1e7, ans = 1e7;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
  return 0;
}
