#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c - '0');
  return x * f;
}
inline void out(int x) {
  if (x >= 10) out(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  int k;
  cin >> k;
  vector<int> v;
  string s;
  while (cin >> s) {
    int h = -1;
    for (int i = (int)0; i < (int)s.size(); i++)
      if (s[i] == '-') {
        v.push_back(i - h);
        h = i;
      }
    v.push_back(s.size() - h);
  }
  int l = 0, r = 1e9;
  v[v.size() - 1]--;
  for (int i = (int)0; i < (int)v.size(); i++) l = max(l, v[i]);
  int ans = 1e9;
  while (l <= r) {
    int mid = (l + r) / 2, x = 0, w = 0;
    for (int i = (int)0; i < (int)v.size(); i++) {
      if (x + v[i] > mid) {
        w++;
        x = 0;
      }
      x += v[i];
    }
    w++;
    if (w <= k) {
      r = mid - 1;
      ans = min(ans, mid);
    } else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
