#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool ok(int len) {
  int cnt = 0;
  int last = -1, pre = -1;
  for (int i = 0; i < s.size(); i++)
    if (!isalpha(s[i])) {
      if (i - pre > len) return 0;
      if (i - last > len) {
        if (pre == last) return 0;
        last = pre;
        cnt++;
      }
      pre = i;
    }
  int tail = s.size() - 1;
  if (tail - pre > len) return 0;
  if (tail - last > len) {
    if (pre == last) return 0;
    last = pre;
    cnt++;
    if (tail - pre > len) return 0;
    last = tail;
    cnt++;
  } else {
    last = tail;
    cnt++;
  }
  return cnt <= n;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  getline(cin, s);
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ') s[i] = '.';
    if ('a' <= s[i] && s[i] <= 'z') s[i] -= 'a' - 'A';
  }
  int l = 1, r = 2000000;
  while (l != r) {
    int mid = (l + r) >> 1;
    if (ok(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << r;
}
