#include <bits/stdc++.h>
using namespace std;
int k;
vector<string> v;
bool check(int m) {
  int kol = 1;
  int r = 0;
  for (auto d : v) {
    if (d.size() > m) return false;
    if (d.size() + r <= m)
      r += d.size();
    else {
      r = d.size();
      ++kol;
    }
  }
  if (kol > k) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> k;
  string str;
  getline(cin, str);
  getline(cin, str);
  string s = "";
  bool f = 1;
  for (int i = 0; i < str.size(); ++i) {
    if (f && (str[i] == ' ' || str[i] == '-')) {
      v.push_back(s);
      s = "";
      f = 0;
      continue;
    }
    if (!f && (str[i] != ' ' && str[i] != '-')) {
      if (v.size() != 0) v.back() += '-';
      f = 1;
      s += str[i];
      continue;
    }
    s += str[i];
  }
  v.push_back(s);
  int l = 0, r = 1e7;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m))
      r = m;
    else
      l = m;
  }
  cout << r;
  return 0;
}
