#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int N = 1e6 + 10;
char s[N];
bool check(const vector<int>& a, int width, int k) {
  int cnt = 0;
  for (int i = 0, j; i < a.size(); i = j) {
    int sum = a[i];
    if (sum > width) return false;
    for (j = i + 1; j < a.size() && sum + a[j] <= width; ++j) sum += a[j];
    ++cnt;
  }
  return cnt <= k;
}
int main() {
  int k;
  scanf("%d\n", &k);
  gets(s);
  vector<int> a;
  for (int i = 0, j; s[i]; i = j) {
    for (j = i + 1; s[j] && s[j] != ' ' && s[j] != '-'; ++j)
      ;
    if (s[j]) ++j;
    a.push_back(j - i);
  }
  int low = 1, high = 1e6;
  while (low < high) {
    int mid = (low + high) / 2;
    if (check(a, mid, k)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  printf("%d\n", high);
  return 0;
}
