#include <bits/stdc++.h>
using namespace std;
int k;
string s;
int bp[1000010];
int v[1000010];
int cnt = 0;
int ans = -1;
bool check(int len) {
  int num = 1;
  int now = 0;
  for (int i = 0; i <= cnt; i++) {
    if (v[i] > len) {
      return 0;
    }
    if (now + v[i] <= len) {
      now += v[i];
    } else {
      now = v[i];
      num++;
    }
  }
  if (now > len) {
    num++;
  }
  return num <= k;
}
int main() {
  cin >> k;
  getchar();
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '-' || s[i] == ' ') {
      bp[++cnt] = i;
    }
  }
  bp[0] = -1;
  bp[cnt + 1] = s.size() - 1;
  for (int i = 0; i <= cnt; i++) {
    v[i] = bp[i + 1] - bp[i];
  }
  int l = 0;
  int r = s.size();
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
