#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
string s;
int n;
bool check(int mid) {
  int pre = -1;
  int last = -1;
  int num = 1;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ' || s[i] == '-') {
      if (i - last < mid) {
        pre = i;
        continue;
      }
      if (i - last == mid) {
        num++;
        last = i;
        pre = i;
        continue;
      }
      num++;
      if (last == pre) return false;
      last = pre;
      if (i - last > mid) return false;
      pre = i;
    }
  }
  if (s.size() - last - 1 > mid) {
    if (last == pre) return false;
    if (s.size() - pre - 1 > mid) return false;
    num++;
  }
  return (num <= n);
}
int main() {
  scanf("%d", &n);
  getline(cin, s);
  getline(cin, s);
  int low = 1, high = s.size(), res = s.size();
  while (high >= low) {
    int mid = (low + high) / 2;
    if (check(mid)) {
      res = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  printf("%d\n", res);
  return 0;
}
