#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, ans;
string s;
vector<int> v;
bool check(int m) {
  int sum = 0, cnt = 0;
  for (int i = 0; i < v.size(); ++i) {
    if (v[i] > m) return false;
    if (sum + v[i] <= m)
      sum += v[i];
    else
      sum = v[i], cnt++;
  }
  if (cnt + 1 > n) return false;
  return true;
}
int main() {
  scanf("%d\n", &n);
  getline(cin, s);
  int cnt = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == ' ' || s[i] == '-')
      v.push_back(cnt + 1), cnt = 0;
    else
      cnt++;
  }
  v.push_back(cnt);
  ans = s.size();
  int l = 0, r = s.size();
  while (l <= r) {
    int m = (l + r) / 2;
    if (check(m)) {
      ans = m;
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  cout << ans << endl;
}
