import java.util.HashMap;
import java.util.Map;
import java.io;
public class test {
private static String WORD = "0";
private static String SENTENCE = "1";
public static Map<String, Integer> getCount(String str) {
str = str.replace(".", "#");
str = str.replace("?", "#");
str = str.replace("!", "#");
int wordCount = str.split(" ").length;
int sentenceCount = str.split("#").length;
Map<String, Integer> map = new HashMap<String, Integer>();
map.put(WORD, wordCount);
map.put(SENTENCE, sentenceCount);
return map;
}
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String x=Integer.parseInt(br.readLine());
Map<String, Integer> map = getCount(x.readLine(x));
System.out.println("单词数量: "+map.get(WORD));
System.out.println("句子数量: " + map.get(SENTENCE));
}
}