#include <bits/stdc++.h>
using namespace std;
bool ch(vector<long long> ans, long long c, long long k) {
  long long pre = 0;
  long long fck = 0;
  for (auto j : ans) {
    if (j > c) return 0;
    if (pre + j > c) {
      fck++;
      pre = j;
    } else {
      pre += j;
    }
  }
  if (pre > 0) fck++;
  return fck <= k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long k;
  cin >> k;
  string a;
  vector<long long> ans;
  while (cin >> a) {
    long long ze = a.length();
    long long old = -1;
    for (long long i = 0; i < ze; i++) {
      if (a[i] == '-') {
        ans.push_back(i - old);
        old = i;
      }
    }
    ans.push_back(ze - old);
  }
  long long xa = ans.size();
  ans[xa - 1]--;
  long long in = 0, fin = 1000007;
  long long x = fin;
  while (fin >= in) {
    long long mid = (fin + in) / 2ll;
    if (ch(ans, mid, k)) {
      fin = mid - 1;
      x = min(x, mid);
    } else {
      in = mid + 1;
    }
  }
  cout << x << '\n';
}
