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