#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << "[" << H << "]";
  debug_out(T...);
}
clock_t startTime;
double getCurrentTime() {
  return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const double eps = 0.00001;
const int MOD = 1e9 + 7;
const int INF = 1000000101;
const long long LLINF = 1223372000000000555;
const int N = 1e6 + 3e1;
const int M = 522;
const int L = 19;
int k;
vector<string> v;
bool check(int w) {
  int lines = 1;
  int cur = 0;
  for (int i = 0; i < v.size(); i++) {
    if (cur + v[i].size() <= w) {
      cur += v[i].size();
      continue;
    }
    lines++;
    cur = v[i].size();
  }
  return lines <= k;
}
void solve(int TC) {
  cin >> k;
  string s;
  while (cin >> s) {
    string t;
    for (char ch : s) {
      t += ch;
      if (ch == '-') {
        v.push_back(t);
        t.clear();
      }
    }
    t += '-';
    v.push_back(t);
  }
  v.back().pop_back();
  int l = 1, r = 1e6;
  for (auto &t : v) l = max(l, ((int)t.size()));
  while (l <= r) {
    int m = (l + r) >> 1;
    if (check(m)) {
      r = m - 1;
    } else
      l = m + 1;
  }
  cout << r + 1;
}
int main() {
  startTime = clock();
  ios_base::sync_with_stdio(false);
  bool llololcal = false;
  int TC = 1;
  for (int test = 1; test <= TC; test++) {
    42;
    solve(test);
  }
  if (llololcal)
    cerr << endl << "Time: " << getCurrentTime() * 1000 << " ms" << endl;
  return 0;
}
