#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 1e9 + 3, mod = 1e9 + 7;
const double ESP = 1e-8;
int k;
string s;
vector<string> A;
bool ok(int x) {
  int tot = 0;
  int cnt = 1;
  string check = "";
  for (string z : A) {
    int n = (int)(z.size());
    if (tot + n <= x) {
      tot += n;
      check += z;
    } else {
      if (n > x) return 0;
      tot = n;
      cnt++;
      check = z;
    }
  }
  return (cnt <= k);
}
int main() {
  scanf("%d\n", &k);
  getline(cin, s);
  string ret = "";
  for (char c : s) {
    if (c == ' ') {
      ret += '.';
      A.push_back(ret);
      ret = "";
    } else if (c == '-') {
      ret += '-';
      A.push_back(ret);
      ret = "";
    } else {
      ret += c;
    }
  }
  A.push_back(ret);
  int lo = 1, hi = (int)1e6, mid, ans;
  while (lo <= hi) {
    mid = lo + ((hi - lo) >> 1);
    if (ok(mid)) {
      hi = mid - 1;
      ans = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << ans;
}
