#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
void in(int &x);
const int N = 1e6 + 10;
int n, k, tot;
vector<int> v;
string s;
bool ok(int x) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > x) return 0;
  }
  int cur = 0;
  for (int i = 0; i < v.size();) {
    int j = i, sum = 0;
    while (j < v.size()) {
      if (sum + v[j] > x) break;
      sum += v[j];
      j++;
    }
    i = j, cur++;
  }
  return cur <= k;
}
int solve() {
  int l = 1, r = tot, mid, sol = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (ok(mid)) {
      r = mid - 1;
      sol = mid;
    } else {
      l = mid + 1;
    }
  }
  return sol;
}
void work() {
  cin >> k;
  getchar();
  getline(cin, s);
  n = s.length();
  int sl = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == ' ' || s[i] == '-') {
      v.push_back(sl + 1);
      sl = 0;
    } else {
      ++sl;
    }
  }
  v.push_back(sl);
  for (int i = 0; i < v.size(); i++) tot += v[i];
  printf("%d\n", solve());
  return;
}
int main() {
  work();
  return 0;
}
void in(int &x) {
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  if (neg) x *= -1;
}
