#include <bits/stdc++.h>
using namespace std;
int a[1000010];
int sum;
int k;
bool judge(int x) {
  int num = 1, cc = 0;
  for (int i = 1; i <= sum; i++) {
    if (cc + a[i] > x) {
      num++;
      cc = a[i];
    } else
      cc += a[i];
  }
  return num <= k;
}
int main() {
  char s[1000010];
  cin >> k;
  getchar();
  gets(s);
  int len = strlen(s);
  int num = 0, i, ma = 0;
  for (i = 0; i < len; i++) {
    if (s[i] == ' ' || s[i] == '-') {
      a[++sum] = num + 1;
      ma = max(ma, num + 1);
      num = 0;
    } else
      num++;
  }
  a[++sum] = num;
  ma = max(ma, num);
  int l = ma, r = 1000000;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (judge(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
}
