A particle in two boxes

Suppose we have a particle in a 1-dimensional box, such that the particle is in its lowest energy state. The energy of a particle in a 1-dimensional box is E = h^2*n^2/(8*m*L^2). Therefore, if the particle is in its lowest energy level, n = 1, and the box has a length of d, then E = h^2/(8*m*d^2). Now suppose we divide the box into two boxes, A and B, using an impenetratable barrier so that each new box has a length of d/2. Now, if the particle is found to be in box A, the minimum energy it can have is n = 1, where E = h^2*n^2/(8*m*L^2) and therefore, E= h^2/(8*m*(d/2)^2) = 4*h^2/(8*m*d^2). This is the same for the particle being found in box B by symmetry. How is it possible that the energy has increased by simply adding a dividing barrier.