This paper focuses on minimizing a shape functional through the solution of a Pure Dirichlet boundary value problem, and a Dirichlet-Robin boundary value problem. This shape optimization problem is a variant of the Kohn-Vogelius shape optimization formulation of a Bernoulli free boundary problem. The first- and second-order shape derivatives of the cost functional under consideration are explicitly derived. Interestingly, the present findings coincide with the existing results regarding solutions to the Bernoulli problem.