implicit none integer(8) i,n,m,j,a,b integer(8),allocatable :: x(:,:) integer(8),allocatable :: y(:) read(*,*) n allocate (x(1:n+1,1:3)) allocate (y(1:10)) x=0 y=0 a=0 b=0 do i=1,n read(*,*) (x(i,m),m=1,3) do j=1,3 y(x(i,j))=y(x(i,j))+1 if (y(x(i,j))==2) then a=a+1 y(x(i,j))=y(x(i,j))-2 end if end do end do do i=1,11 if (y(i) == 1) then b=b+1 end if end do b=b/4 write(*,*) a+b end