#include <bits/stdc++.h>
using namespace std;
int k;
int n;
char ad[1000021];
vector<int> v;
bool Valid(int d) {
  int cur = 0;
  int s = 1;
  for (int i = 0; i < v.size(); ++i) {
    if (cur + v[i] <= d) {
      cur += v[i];
    } else if (v[i] <= d) {
      ++s;
      cur = v[i];
    } else {
      return false;
    }
  }
  return s <= k;
}
int main() {
  scanf("%d ", &k);
  gets(ad);
  n = strlen(ad);
  for (int i = 0; i < n; ++i) {
    if (ad[i] == '-') {
      ad[i] = ' ';
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    ++cnt;
    if (ad[i] == ' ') {
      v.push_back(cnt);
      cnt = 0;
    } else if (ad[i] == '\n') {
      --cnt;
    }
  }
  v.push_back(cnt);
  int l = 1, r = n;
  while (l < r) {
    int mid = l + r >> 1;
    if (Valid(mid)) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", l);
  return 0;
}
