Lyubeznik numbers of almost complete intersection and linked ideals