#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-7;
const double PI = acos(-1.0);
const int N = 1e5 + 5;
long long k, n;
string s;
vector<long long> words;
bool valid(long long mid) {
  long long sum = 0, cnt = 1;
  for (auto i : words) {
    if (i > mid) return false;
    if (sum + i <= mid)
      sum += i;
    else {
      sum = i;
      ++cnt;
    }
  }
  return cnt <= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> k;
  cin.ignore();
  getline(cin, s);
  long long cnt = 0;
  for (char c : s) {
    ++cnt;
    if (c == '-' || c == ' ') {
      words.push_back(cnt);
      cnt = 0;
    }
  }
  words.push_back(cnt);
  long long l = 0, r = (int)s.size();
  while (l < r) {
    long long mid = l + ((r - l) >> 1);
    if (valid(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << "\n";
}
