#include <bits/stdc++.h>
using namespace std;
int n, k, l, r, midl;
char zn[1000100];
string ss;
string s[1000100];
bool check(int par) {
  int ch = 1, sum = 0;
  for (int i = 1; i <= n; ++i) {
    if (s[i].size() > par) {
      return 0;
    }
    if (sum + s[i].size() > par) {
      sum = 0;
      ch++;
    }
    sum += s[i].size();
  }
  if (ch > k) {
    return 0;
  }
  return 1;
}
int main() {
  cin >> k;
  scanf("\n");
  n = 1;
  getline(cin, ss);
  for (int i = 0; i < ss.size(); ++i) {
    s[n] += ss[i];
    if (ss[i] == ' ' || ss[i] == '-') {
      zn[n++] = ss[i];
      continue;
    }
  }
  l = 0;
  r = 1e6 + 1;
  while (r - l > 1) {
    midl = (l + r) / 2;
    if (check(midl)) {
      r = midl;
    } else {
      l = midl;
    }
  }
  cout << r;
}
