#include <bits/stdc++.h>
using namespace std;
int k = 0;
vector<int> v;
int check(int c) {
  int s = 0, res = 0;
  for (int i = 0; i < v.size(); i++) {
    if (s + v[i] > c) {
      s = 0;
      res++;
    }
    s += v[i];
  }
  res++;
  return res;
}
char cs[1000002];
int main() {
  cin >> k;
  string s;
  int c = 0, x = 0, ma = 0;
  gets(cs);
  gets(cs);
  s = cs;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '-' || s[i] == ' ') {
      v.push_back(c + 1);
      ma = max(ma, c + 1);
      c = 0;
    } else {
      c++;
      ma = max(ma, c);
    }
  }
  ma = max(ma, c);
  v.push_back(c);
  int ans = 0, l = ma, r = 1000000, m = 0;
  while (l <= r) {
    m = (l + r) / 2;
    if (check(m) > k) {
      l = m + 1;
    } else {
      ans = m;
      r = m - 1;
    }
  }
  cout << ans;
}
