#include <bits/stdc++.h>
using namespace std;
int k, n;
string s;
bool solve(int x) {
  int sum = 0, lines = 1;
  for (int i = 0; i < n; i++) {
    int curr_len = 0;
    while (i < n && s[i] != ' ') {
      curr_len++;
      i++;
    }
    if (i == n) {
    } else {
      curr_len++;
    }
    sum += curr_len;
    if (sum <= x) {
    } else {
      lines++;
      if (curr_len > x) {
        return false;
      }
      sum = curr_len;
    }
  }
  return (lines <= k);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> k;
  char c;
  cin >> c;
  getline(cin, s);
  s = c + s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    if (s[i] == '-') {
      s[i] = ' ';
    }
  }
  int lo = 1, hi = n;
  while (lo <= hi) {
    int mid = lo + (hi - lo) / 2;
    if (solve(mid)) {
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  cout << hi + 1;
  return 0;
}
