#include <bits/stdc++.h>
using namespace std;
bool verify(vector<int> word_sizes, int width, int k) {
  int current_size = 0;
  int num_splits = 0;
  for (int i = 0; i < word_sizes.size(); ++i) {
    current_size += word_sizes[i];
    if (current_size > width) {
      current_size = word_sizes[i];
      num_splits += 1;
      if (num_splits > k - 1) {
        return false;
      }
    }
  }
  return true;
}
int binSearch(vector<int> word_sizes, int k, int max, int sum) {
  int l = max;
  int r = sum;
  int m = (l + r) / 2;
  do {
    if (verify(word_sizes, m, k)) {
      r = m;
    } else {
      l = m + 1;
    }
    m = (l + r) / 2;
  } while (l < r);
  return l;
}
int main() {
  string input;
  int k;
  getline(cin, input);
  k = stoi(input);
  getline(cin, input);
  int length = input.length();
  vector<int> word_sizes;
  int j = 0;
  int max = 0;
  for (int i = 0; i < input.length(); ++i) {
    char c = input[i];
    j++;
    if (c == '-' || c == ' ') {
      word_sizes.push_back(j);
      if (j > max) {
        max = j;
      }
      j = 0;
    }
  }
  word_sizes.push_back(j);
  if (j > max) {
    max = j;
  }
  int l = max;
  int r = input.length();
  cout << binSearch(word_sizes, k, l, r);
}
