#include <bits/stdc++.h>
using namespace std;
string s;
int k;
bool is_fit(int w) {
  int rows = 1;
  int i = 0;
  int len = 0;
  int used = 0;
  while (i < s.length()) {
    if (s[i] != ' ' && s[i] != '-') {
      len++;
      if (len > w) {
        return false;
      }
    } else {
      if (used + len + 1 <= w) {
        used += len + 1;
      } else {
        if (len + 1 > w) {
          return false;
        }
        rows++;
        used = len + 1;
      }
      len = 0;
    }
    i++;
  }
  if (used + len <= w) {
    used += len;
  } else {
    rows++;
    used = len;
  }
  return rows <= k;
}
int main() {
  cin >> k;
  cin.ignore();
  getline(cin, s);
  int len = s.length();
  int l = 0, r = len;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (is_fit(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r;
  return 0;
}
