#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int maxn = 1e6 + 5;
const int INF = 0x7fffffff;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
char ch[maxn];
int res[maxn];
int k;
int n;
bool ok(int x) {
  int sum = 0, num = 0;
  for (int i = 0; i < k; i++) {
    if (sum + res[i] > x) {
      sum = 0;
      num++;
    }
    sum += res[i];
  }
  if (sum != 0) num++;
  if (num <= n)
    return 1;
  else
    return 0;
}
int main() {
  scanf("%d\n", &n);
  int len = 0;
  while (~scanf("%c", &ch[len++]) && ch[len - 1] != '\n')
    ;
  int pos = -1, l = 0;
  for (int i = 0; i < len; i++) {
    if (ch[i] == '-' || ch[i] == ' ') {
      res[k++] = i - pos;
      pos = i;
      l = max(l, res[k - 1]);
    }
  }
  res[k++] = len - pos - 2;
  l = max(l, res[k - 1]);
  l--;
  int r = len;
  while (r - l > 1) {
    if (ok((l + r) / 2))
      r = (l + r) / 2;
    else
      l = (l + r) / 2;
  }
  printf("%d\n", r);
}
