#include <bits/stdc++.h>
using namespace std;
int k;
string str;
vector<int> v;
bool ok(int lim) {
  int cnt = 0;
  int pre = -1;
  int idx = 0;
  while (idx < v.size()) {
    while (idx < v.size() && v[idx] - pre <= lim) ++idx;
    ++cnt;
    if (idx == 0) return false;
    pre = v[idx - 1];
    if (cnt > k) return false;
  }
  return cnt <= k;
}
int find() {
  int L = 0, R = 1000000, ret = -1;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (ok(mid))
      ret = mid, R = mid - 1;
    else
      L = mid + 1;
  }
  return ret;
}
int main() {
  scanf("%d", &k);
  getline(cin, str);
  getline(cin, str);
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == ' ' || str[i] == '-') {
      v.push_back(i);
    }
  }
  v.push_back((int)str.size() - 1);
  int ans = find();
  printf("%d", ans);
}
