#include <bits/stdc++.h>
using namespace std;
long long int n;
string s;
vector<long long int> ss;
inline bool check(long long int lim) {
  long long int sum = 0, cnt = 0;
  for (long long int i = 0; i < ss.size(); i++) {
    if (sum + ss[i] <= lim) {
      sum += ss[i];
    } else {
      cnt++;
      sum = ss[i];
    }
  }
  cnt++;
  if (cnt <= n) return true;
  return false;
}
int main() {
  cin >> n;
  cin.ignore();
  getline(cin, s);
  long long int pos = 0;
  for (long long int i = 0; i < s.length(); i++) {
    if (s[i] == '-' || s[i] == ' ') {
      ss.push_back(i - pos + 1);
      pos = i + 1;
    }
  }
  ss.push_back(s.length() - pos);
  long long int low, high, mid;
  high = s.length();
  low = -1;
  for (long long int i = 0; i < ss.size(); i++) low = max(low, ss[i]);
  long long int ans = high;
  while (low <= high) {
    mid = (low + high) / 2;
    if (check(mid)) {
      high = mid - 1;
      ans = min(ans, mid);
    } else
      low = mid + 1;
  }
  cout << ans;
  return 0;
}
