#include <bits/stdc++.h>
using namespace std;
int w;
struct Node
{
string s;
int f; // 1段落 2项目开头 3项目第2-n段落
};
vector<Node> all;
bool f2(string &str)
{
return str.size() >= 2 && str[0] == '*' && str[1] == ' ';
}
int f3(string &str)
{
return str.size() >= 2 && str[0] == ' ' && str[1] == ' ';
}
string del(string s)
{
int l = 0, r = s.size() - 1;
while(l <= r && s[l] == ' ') l ++;
while(r >= l && s[r] == ' ') r --;
return s.substr(l, r - l + 1);
}
int main()
{
ios::sync_with_stdio(false);
//freopen("1.txt","r",stdin);
cin >> w;
bool f = false;
string str;
while(cin, str))
{
if(str.size() == count(str.begin(),str.end(), ' ')) f = true;
else
{
if(f || all.empty())
{
if(str.size() >= 2 && str[0] == '*' && str[1] == ' ') all.push_back({del(str.substr(2)), 2});
else all.push_back({del(str), 1});
}
else
{
auto &last = all.back();
if(last.f == 1)
{
if(f2(str)) all.push_back({del(str.substr(2)), 2});
else last.s += " " + del(str);
}
else
{
if(f3(str)) last.s += " " + del(str.substr(2));
else if(f2(str)) all.push_back({del(str.substr(2)), 3});
else all.push_back({del(str), 1});
}
}
f = false;
}
}
int ans = 0;
for(int i = 0; i < all.size(); ++i)
{
str = all[i].s;
if(all[i].f != 3 && i) ans ++;
if(all[i].f == 1)
{
for(int i = 0; i < str.size(); i += w)
{
while(str[i] == ' ') i ++;
ans ++;
}
}
else
{
if(all[i].s.size() == 0) ans ++;
for(int i = 0; i < str.size(); i += w - 3)
{
while(str[i] == ' ') i ++;
ans ++;
}
}
}
cout << ans;
}