#include <bits/stdc++.h>
using namespace std;
const int MAXX = 1e6 + 5, INF = 1e9 + 7;
int n, m, k, i, j, s, ans, l, r;
int a[MAXX], b[MAXX];
vector<int> v;
string s1, s2, s3;
bool u[MAXX];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin.ignore();
  getline(cin, s1);
  for (i = 0; i < s1.size(); i++)
    if (s1[i] == '-') s1[i] = ' ';
  i = 0;
  v.push_back(0);
  while (i < s1.size()) {
    if (s1[i] != ' ')
      v[v.size() - 1]++;
    else {
      v[v.size() - 1]++;
      v.push_back(0);
    }
    i++;
  }
  for (i = 0; i < v.size(); i++) l = max(l, v[i]);
  l--, r = s1.size();
  while (r - l > 1) {
    int t = (l + r) / 2;
    s = 0, k = 1;
    for (i = 0; i < v.size(); i++) {
      if (v[i] + s <= t)
        s += v[i];
      else {
        s = v[i];
        k++;
      }
      if (k > n) break;
    }
    if (k > n)
      l = t;
    else
      r = t;
  }
  cout << r;
}
