#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
long long k;
string s;
vector<long long> v;
long long get_height(long long w) {
  long long h = 1, curr = 0;
  for (auto i : v) {
    if (i > w) {
      return inf;
    }
    if (curr + i > w) {
      h++;
      curr = i;
    } else {
      curr += i;
    }
  }
  return h;
}
signed main() {
  cin >> k;
  cin.ignore();
  getline(cin, s);
  s += ' ';
  long long len = 1;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '-' || s[i] == ' ') {
      v.push_back(len);
      len = 1;
    } else {
      len++;
    }
  }
  v[v.size() - 1]--;
  long long l = 0, r = 1e6;
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (get_height(mid) <= k) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r;
}
