#include <bits/stdc++.h>
using namespace std;
namespace aux {
template <std::size_t...>
struct seq {};
template <std::size_t N, std::size_t... Is>
struct gen_seq : gen_seq<N - 1, N - 1, Is...> {};
template <std::size_t... Is>
struct gen_seq<0, Is...> : seq<Is...> {};
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void print_tuple(std::basic_ostream<Ch, Tr>& os, Tuple const& t, seq<Is...>) {
  using swallow = int[];
  (void)swallow{0,
                (void(os << (Is == 0 ? "" : ", ") << std::get<Is>(t)), 0)...};
}
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
}  // namespace aux
template <class Ch, class Tr, class... Args>
auto operator<<(std::basic_ostream<Ch, Tr>& os, std::tuple<Args...> const& t)
    -> std::basic_ostream<Ch, Tr>& {
  os << "(";
  aux::print_tuple(os, t, aux::gen_seq<sizeof...(Args)>());
  return os << ")";
}
template <class S, class T>
std::ostream& operator<<(std::ostream& o, const std::pair<S, T>& p) {
  return o << "(" << p.first << ", " << p.second << ")";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << "[";
  if (vec.size() != 0) {
    std::copy(vec.begin(), vec.end() - 1, std::ostream_iterator<T>(os, ", "));
    os << vec.back();
  }
  return os << "]";
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& s) {
  os << "{";
  if (s.size() != 0) {
    std::copy(s.begin(), --s.end(), std::ostream_iterator<T>(os, ", "));
    os << *(--s.end());
  }
  return os << "}";
}
template <class It, char Delim = ' '>
void print_range(It a, It b) {
  for (auto it = a; it != b; it++) {
    cout << *it << Delim;
  }
  cout << "\n";
}
void run_test(int test_number);
struct Test {
  Test(int test_number) : test_number(test_number) {}
  int test_number;
  void input();
  void output();
  void solve();
  void run() {
    input();
    solve();
    output();
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.setf(ios::fixed);
  cout.precision(9);
  cerr.setf(ios::fixed);
  cerr.precision(3);
  int num_tests = 1;
  for (int i = 1; i <= num_tests; i++) {
    Test cur(i);
    cur.run();
  }
}
const int MAX_N = 1000005;
int k;
vector<string> words;
void Test::input() {
  cin >> k;
  string line;
  while (line.empty()) {
    getline(cin, line);
  }
  string cur_word{};
  for (char c : line) {
    cur_word += c;
    if (c == ' ' || c == '-') {
      words.push_back(cur_word);
      cur_word.clear();
    }
  }
  words.push_back(cur_word);
}
bool possible(int width) {
  int cur_width = 0;
  int used_lines = 1;
  for (const auto& word : words) {
    if (cur_width + word.size() <= width) {
      cur_width += word.size();
    } else {
      used_lines++;
      if (word.size() > width) {
        return false;
      }
      cur_width = word.size();
    }
  }
  return used_lines <= k;
}
void Test::solve() {
  int lo = 0;
  int hi = MAX_N;
  while (lo < hi - 1) {
    int mid = (lo + hi) / 2;
    if (possible(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << hi << endl;
}
void Test::output() {}
