program main implicit none integer*8::N,dist(1:100),i,j,k,total integer*8,allocatable::A(:) data dist/100*0/,total/0/ read *,N allocate(A(N)) read *,A do i=1, N dist(A(i)) = dist(A(i)) + 1 end do do i=1,100 do j=i+1,100 do k=j+1,100 total = total + dist(i)*dist(j)*dist(k) end do end do end do total = MOD(total,10**9+7) print '(i0)', total end program main