import java.util.*;
public class uva494 {
public static void main(String [] args) {
Scanner scn = new Scanner(System.in);
while(scn.hasNext()) {
int count = 0;
String word = scn.nextLine();
StringTokenizer st = new StringTokenizer(word," ");
while(st.hasMoreTokens()) {
String s = st.nextToken();
boolean bool = false;
int co = 0;
for(int x=0;x<s.length();x++) {
char c = s.charAt(x);
if(c >= \'a\' && c<= \'z\' || c >= \'A\' && c<= \'Z\') {
bool = true;
co++;
}
else {
bool = false;
}
if(!bool && co > 0) {
count++;
co = 0;
}
}
if(bool) {
count++;
}
}
System.out.println(count);
}
}
}