Computing the Inertia from Sign Patterns