import sys A =[] B =[] C=[] D=[] E=[] wrong=[] pri= [] for line in sys.stdin: cnt=line is_wrong = 0 a = line.strip().split("~") ip,mask = a[0], a[1] iplist = ip.split('.') masklist= mask.split('.') if iplist[0] =='0' or iplist[0]=='127': continue if len(iplist)!=4 or len(masklist)!=4: wrong.append(cnt) is_wrong =1 continue for i in iplist: if not i.isdigit(): wrong.append(cnt) is_wrong =1 break if int(i)>255 or int(i)<0: wrong.append(cnt) is_wrong =1 break if is_wrong: continue twostr = '' for i in masklist: if not i.isdigit(): wrong.append(cnt) is_wrong =1 break if int(i)>255 or int(i)<0: wrong.append(cnt) is_wrong =1 break intwo = bin(int(i))[2:] twostr += intwo.zfill(8) is_one=1 if twostr[0]==0: wrong.append(cnt) is_wrong =1 continue for i in twostr: if i=='0': is_one=0 if is_one==0 and i=='1': wrong.append(cnt) is_wrong =1 break if is_one: wrong.append(cnt) is_wrong =1 continue if is_wrong: continue if int(iplist[0])>=1 and int(iplist[0])<=126: A.append(cnt) if int(iplist[0])>=128 and int(iplist[0])<=191: B.append(cnt) if int(iplist[0])>=192 and int(iplist[0])<=223: C.append(cnt) if int(iplist[0])>=224 and int(iplist[0])<=239: D.append(cnt) if int(iplist[0])>=240 and int(iplist[0])<=255: E.append(cnt) if (int(iplist[0])==10) or (int(iplist[0])==172 and int(iplist[1])>=16 and int(iplist[1])<=31) or (int(iplist[0])==192 and int(iplist[1])==168): pri.append(cnt) print(len(A),len(B),len(C),len(D),len(E),len(wrong),len(pri))