#include <bits/stdc++.h>
inline void in(int &MAGNUS) { scanf("%d", &MAGNUS); }
inline void out(int MAGNUS) { printf("%d\n", MAGNUS); }
inline void in(int &MAGNUS, int &CLAR) { scanf("%d%d", &MAGNUS, &CLAR); }
inline void out(int MAGNUS, int CLAR) { printf("%d %d\n", MAGNUS, CLAR); }
inline void inl(long long &LIV) { scanf("%lld", &LIV); }
inline void inl(long long &LIV, long long &MART) {
  scanf("%lld%lld", &LIV, &MART);
}
inline void outl(long long LIV) { printf("%lld\n", LIV); }
inline void outl(long long LIV, long long MART) {
  printf("%lld %lld\n", LIV, MART);
}
using namespace std;
int R;
string s, res;
vector<string> kata;
bool ok(int C) {
  int r = 1, c = 0;
  for (int i = 0; i <= (int)kata.size() - 1; i++) {
    if (kata[i].size() > C) return 0;
    if (c + (int)kata[i].size() <= C) {
      c += (int)kata[i].size();
    } else {
      r++;
      c = 0;
      c += (int)kata[i].size();
    }
  }
  return r <= R;
}
int main() {
  in(R);
  getchar();
  getline(cin, s);
  res = "";
  for (int i = 0; i <= (int)s.size() - 1; i++) {
    if (s[i] == ' ') s[i] = '.';
    res += (char)s[i];
    if (!isalpha(s[i])) {
      kata.push_back(res);
      res = "";
    }
  }
  kata.push_back(res);
  int lo = 1, hi = (int)s.size(), ans = 1 << 30;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (ok(mid)) {
      hi = mid - 1;
      ans = mid;
    } else
      lo = mid + 1;
  }
  out(ans);
  return 0;
}
