#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  short negative = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') negative = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  x *= negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
vector<long long> v;
int n;
void w(string s) {
  v.push_back(0);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ' || s[i] == '-') v.push_back(i + 1);
  }
  v.push_back(s.size());
}
bool check(int mid) {
  int len = 0, g = 1;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] - v[i - 1] > mid) return 0;
    if (len + (v[i] - v[i - 1]) <= mid)
      len += (v[i] - v[i - 1]);
    else {
      g++;
      len = v[i] - v[i - 1];
    }
  }
  return g <= n;
}
int main() {
  read(n);
  char s[1000010];
  gets(s);
  w(s);
  int l = 1, r = 1e6, res = 1e5;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      r = mid - 1;
    else {
      l = mid + 1;
    }
  }
  cout << l << endl;
  return 0;
}
