#include <bits/stdc++.h>
using namespace std;
int k, co;
vector<int> v;
char c;
bool moze(int mid) {
  int br = 1, dulj = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > mid) return false;
    dulj += v[i];
    if (dulj > mid) {
      dulj -= v[i];
      br++;
      dulj = v[i];
    }
  }
  if (br > k) {
    return false;
  }
  return true;
}
int main() {
  scanf("%d ", &k);
  do {
    scanf("%c", &c);
    co++;
    if (c == '-' || c == ' ') {
      v.push_back(co);
      co = 0;
    }
  } while (c != '\n');
  v.push_back(co - 1);
  int mind = 1000005, maksd = 0;
  for (int i = 0; i < v.size(); i++) {
    mind = min(mind, v[i]);
    maksd = max(maksd, v[i]);
  }
  int hi = 1000005, lo = mind, mid;
  while (lo + 1 < hi) {
    mid = (hi + lo) / 2;
    if (moze(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  if (moze(lo)) hi = lo;
  cout << hi << endl;
  return 0;
}
