#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 11;
string s;
int k, co, a[maxn], st;
int cnt(int x) {
  int c = 1, sum = 0;
  for (int i = 0; i < co; i++) {
    sum += a[i];
    if (sum > x) {
      c++;
      sum = a[i];
    }
  }
  return c;
}
int main() {
  cin >> k;
  getchar();
  getline(cin, s);
  int pos = -1;
  int ll = s.size(), i;
  for (i = 0; i < ll; i++) {
    if (s[i] == '-' || s[i] == ' ') {
      st = max(st, i - pos);
      a[co++] = i - pos;
      pos = i;
    }
  }
  a[co++] = i - pos - 1;
  st = max(st, i - pos - 1);
  int l = st, r = ll;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (cnt(mid) <= k)
      r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", l);
  return 0;
}
