#include <bits/stdc++.h>
using namespace std;
string s;
long long n;
vector<long long> v;
bool check(long long x) {
  long long pos = 0;
  long long ret = 0;
  for (int i = 0; i < (int)v.size(); i++) {
    pos += v[i];
    if (pos > x) {
      pos = v[i];
      ret++;
    }
  }
  return ret + 1 <= n;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  s = "";
  while (s == "") getline(cin, s);
  long long cur = 0, l = 0, r = s.size(), mid;
  for (int i = 0; i < (int)s.size(); i++) {
    cur++;
    if (s[i] == ' ' || s[i] == '-') {
      l = max(l, cur);
      v.push_back(cur);
      cur = 0;
    }
  }
  l = max(l, cur);
  v.push_back(cur);
  while (l < r) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
}
