#include <bits/stdc++.h>
using namespace std;
vector<int> v;
string str;
int len, k;
bool ok(int mid) {
  int i, cnt, sum, f;
  sum = 0;
  cnt = 0;
  for (i = 0; i < len; i++) {
    if (sum > mid) return 0;
    f = 1;
    if (sum + v[i] <= mid) {
      sum += v[i];
    } else {
      if (sum == 0) return 0;
      sum = 0;
      i--;
      cnt++;
    }
  }
  if (sum) cnt++;
  if (cnt <= k)
    return 1;
  else
    return 0;
}
int main() {
  int i, sum, hi, lo, mid, tmp, ans;
  cin >> k;
  getchar();
  getline(cin, str);
  len = str.size();
  sum = 0;
  tmp = len;
  for (i = 0; i < len; i++) {
    if (str[i] == ' ') {
      v.push_back(sum + 1);
      sum = 0;
    } else if (str[i] == '-') {
      sum++;
      v.push_back(sum);
      sum = 0;
    } else
      sum++;
  }
  if (sum) {
    v.push_back(sum);
  }
  len = v.size();
  lo = 1;
  hi = tmp;
  ans = -1;
  while (hi >= lo) {
    mid = lo + hi;
    mid = mid / 2;
    if (ok(mid)) {
      hi = mid - 1;
      ans = mid;
    } else
      lo = mid + 1;
  }
  cout << ans << endl;
}
