Program main
  implicit none
  integer :: N
  character(len=10),allocatable :: S(:)
  integer :: i,j
  character(len=10), allocatable :: list(:)
  type testt
     character(len=10) :: name
  end type testt
  read(*,*) N
  allocate(S(N))
  do i = 1,N
     read(*,*) S(i)
  end do
  list = deduplicate(S)
  write(*,'(i0)') size(list)
contains
  recursive function deduplicate(texts) result(res) ! skew-quicksort
    character(*), intent(in) :: texts(:)
    character(:), allocatable :: res(:)
    integer :: m
    
    m = size(texts) / 2
    
    if (m < 1) then
       res = texts
    else
       res = [ deduplicate(pack(texts, texts < texts(m))), &
            texts(m), &
            deduplicate(pack(texts, texts > texts(m)))  ]
    end if
  end function deduplicate
end program main
