#include <bits/stdc++.h>
using namespace std;
vector<int> v1;
int main() {
  int N;
  cin >> N;
  string s1;
  cin.ignore();
  getline(cin, s1);
  for (int i = 0; i < s1.length(); i++) {
    if (s1[i] == ' ' || s1[i] == '-') {
      v1.push_back(i);
    }
  }
  v1.push_back(s1.length() - 1);
  int l = 0, r = s1.length(), ans;
  while (l <= r) {
    int mid = (l + r) / 2, k = 0, sum = 0, t;
    int i = 0, t1 = 0;
    while (i < v1.size()) {
      t = ((i == 0) ? v1[i] + 1 : v1[i] - v1[i - 1]);
      if (sum + t <= mid) {
        sum += t;
        i++;
      } else {
        if (sum == 0) {
          t1 = 1;
          break;
        }
        sum = 0;
        k++;
      }
    }
    if (k + 1 > N || t1 == 1) {
      l = mid + 1;
    } else {
      ans = mid;
      r = mid - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
