#include <bits/stdc++.h>
using namespace std;
int masCount = 1;
int maxRows;
bool check(int maxLen, vector<int> mas) {
  int t = maxLen, rows = 1;
  for (int i = 0; i < masCount; i++) {
    if (mas[i] > maxLen) return false;
    if (mas[i] <= t) {
      t -= mas[i];
    } else {
      rows++;
      t = maxLen - mas[i];
    }
  }
  return rows <= maxRows;
}
int build(int from, int to, vector<int> mas) {
  if (to - from < 2) {
    if (check(from, mas)) return from;
    return to;
  }
  int mid = (from + to) / 2;
  if (check(mid, mas)) {
    return build(from, mid, mas);
  } else {
    return build(mid + 1, to, mas);
  }
}
int main() {
  cin >> maxRows;
  string row;
  std::getline(std::cin, row);
  std::getline(std::cin, row);
  for (int i = 0; i < row.length(); i++) {
    if (row[i] == ' ')
      masCount++;
    else if (row[i] == '-')
      masCount++;
  }
  vector<int> mas(masCount);
  int currentLength = 0, currentIndex = 0;
  for (int i = 0; i < row.length(); i++) {
    currentLength++;
    if (row[i] == ' ' || row[i] == '-') {
      mas[currentIndex] = currentLength;
      currentLength = 0;
      currentIndex++;
    }
  }
  mas[currentIndex] = currentLength;
  cout << build(row.length() / maxRows + (row.length() % maxRows == 0 ? 0 : 1),
                row.length(), mas);
  return 0;
}
