#include <bits/stdc++.h>
using namespace std;
int ni() {
  int val;
  scanf("%i", &val);
  return val;
}
pair<int, int> npi() {
  pair<int, int> val;
  scanf("%i %i", &val.first, &val.second);
  return val;
}
int64_t nll() {
  int64_t val;
  scanf("%I64d", &val);
  return val;
}
vector<int> nvi(int n, int corr = 0) {
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = ni() + corr;
  return move(a);
}
char nc() {
  char val;
  do {
    val = getchar();
  } while (val == ' ' || val == '\r' || val == '\n');
  return val;
}
char ncs() {
  char val;
  do {
    val = getchar();
  } while (false);
  return val;
}
string ns() {
  static char buff[1024 * 4000];
  scanf("%s", buff);
  return string{buff};
}
string nse() {
  static char buff[1024 * 4000];
  string first = ns();
  cin.getline(buff, size_t(1023 * 4000));
  first += string{buff};
  return move(first);
}
int64_t gcd(int64_t a, int64_t b) {
  while (b) {
    auto tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int64_t tr2(int xv1, int yv1, int xv2, int yv2, int x3, int y3) {
  return 1LL * (xv2 - xv1) * (y3 - yv1) - 1LL * (yv2 - yv1) * (x3 - xv1);
}
const long double eps = 1e-12;
bool eq(long double a, long double b) { return abs(a - b) <= eps; }
int8_t bits_cnt[256];
const string input_dir = "inputs\\";
string input_file = input_dir + "input.txt";
string output_file = input_dir + "output.txt";
void init_streams() {}
void init_data() {
  bits_cnt[0] = 0;
  for (int i = 1; i <= 255; ++i)
    for (int j = 0; j < 8; ++j)
      if ((1 << j) & i) ++bits_cnt[i];
}
int get_bit_count(int v) {
  return bits_cnt[v & 0xFF] + bits_cnt[(v >> 8) & 0xFF] +
         bits_cnt[(v >> 16) & 0xFF] + bits_cnt[(v >> 24) & 0xFF];
}
int main() {
  init_streams();
  init_data();
  auto k = ni();
  auto s = nse();
  vector<int> lens;
  for (int i = 0, p = -1; i < s.length(); ++i) {
    if (s[i] == '-' || s[i] == ' ' || (i + 1 == s.length())) {
      lens.emplace_back(i - p);
      p = i;
    }
  }
  int l = *max_element((lens).begin(), (lens).end()), r = s.length() + 7;
  while (l < r) {
    auto mid = (l + r) >> 1;
    auto str_cnt = 0, str_offset = 0;
    for (int j = 0; j < lens.size() && str_cnt < k; ++j) {
      str_offset += lens[j];
      if (str_offset > mid) {
        ++str_cnt;
        str_offset = lens[j];
      }
    }
    if (str_cnt + (str_offset ? 1 : 0) <= k)
      r = mid;
    else
      l = mid + 1;
  }
  printf("%i\n", l);
  return 0;
}
