#include <bits/stdc++.h>
using namespace std;
vector<int> num;
string a;
int k;
bool check(int mid) {
  int line = 1;
  int sum = 0;
  for (int i = 0; i < num.size(); i++) {
    if (sum + num[i] <= mid)
      sum += num[i];
    else {
      sum = num[i];
      if (sum > mid) return false;
      line++;
    }
  }
  if (line > k) return false;
  return true;
}
int main() {
  cin >> k;
  getchar();
  getline(cin, a);
  int ans;
  int l = 1, r = a.length();
  int index = 0;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] == ' ' || a[i] == '-') {
      num.push_back(i - index + 1);
      index = i + 1;
    }
  }
  if (index < a.length()) num.push_back(a.length() - index);
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << '\n';
  return 0;
}
