#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, -1, 0, 1, -1, -1, 1};
const int dy[] = {-1, 0, 0, 1, 1, 1, -1, -1};
const int N = 0;
const int MOD = 0;
const int INF = 1e9 + 10;
const long long int LLINF = 1e18 + 10;
vector<string> v;
int mx;
void muda(string palavra) {
  string s = "";
  for (int i = 0; i < palavra.size(); i++) {
    if (palavra[i] == '-') {
      s += '-';
      v.push_back(s);
      s = "";
    } else
      s += palavra[i];
  }
  s += ' ';
  v.push_back(s);
}
bool pode(int tamanho) {
  int linhas = 1;
  int tam = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].size() > tamanho) return false;
    if (tam + v[i].size() <= tamanho) {
      tam += v[i].size();
    } else {
      tam = v[i].size();
      linhas++;
    }
  }
  return linhas <= mx;
}
int main() {
  stringstream ss;
  string s;
  scanf("%d", &mx);
  getchar();
  getline(cin, s);
  ss << s;
  while (ss >> s) muda(s);
  v[v.size() - 1].erase(v[v.size() - 1].begin() + v[v.size() - 1].size() - 1);
  int ans = -1;
  int lo = 0, hi = 10000000;
  for (int i = 0; i < 60; i++) {
    int mid = (lo + hi) / 2;
    if (!pode(mid)) {
      lo = mid;
    } else {
      hi = mid;
      ans = mid;
    }
  }
  printf("%d\n", ans);
  return 0;
}
