/*
AizuOnline A1305
Title:Membership Management
@kankichi573
13/9/3 TLE
*/
#include <stdio.h>
#include <string.h>
//Global data section];
int n;
int cnt;
#define MEIBOSIZE 10000
char meibo[MEIBOSIZE][15];
int  keisuu[15]={977,1811,691,463,4421,199,991,1607,
                 607,877,1427,1087,383,433,1213};
//
int hashfunc(char * s)
{
        int i,sum;

        sum=0;
        for(i=0;i<16 && s[i];i++)
        {
                sum+=keisuu[i]*(s[i]-'a'+1);
        }

        sum %= MEIBOSIZE;
        if(sum<0)
                sum += MEIBOSIZE;
        //printf("sum=%d\n",sum);
        return(sum);
}
int find(char * s)
{
        int hash;
        hash=hashfunc(s);
        while(meibo[hash][0])
        {
                if(0==strcmp(s,&meibo[hash][0]))
                        return(hash);
                hash++;
                if(hash>=MEIBOSIZE)
                        hash=0;
        }
        return(-1);
}
void regist(char * s)
{
        int hash;
        hash=hashfunc(s);
        while(meibo[hash][0])
        {
                hash++;
                if(hash>=MEIBOSIZE)
                        hash=0;
        }
        strcpy(&meibo[hash][0],s);
}
main()
{
        int i;
        char buf[1000];
        char *p;

        cnt=0;
        while(EOF!=scanf("%d",&n) && n)
        {
                scanf("%s",buf);
                p=strtok(buf,":");
                //printf("Gr=%s\n",buf);
                if(find(buf)==-1)
                        regist(buf);
                else
                        cnt--;
                //printf("++\n");
                while(p=strtok(NULL,",."))
                {
                        //printf("Gr=%s\n",p);

                        if(find(p)==-1)
                        {
                                regist(p);
                                cnt++;
                        }
                }
        }
        printf("%d\n",cnt);
        return(0);
}