# LaTex beamer: algorithm line number outside the box

I'm trying to put an algorithm in a beamer document (using the algorithm2e package). But the line numbers are being printed outside the box. Rest of the text is also printed somewhat left-shifted. The issue mentioned in this question is identical, except I did not import the parskip package.

MWE:

\documentclass[aspectratio = 169]{beamer}

\usepackage[linesnumbered, boxruled, boxed]{algorithm2e}
\usepackage{algpseudocode}

\SetKwInput{KwInput}{Input}

\begin{document}
\begin{frame}{Algorithm}
\begin{algorithm}[H]
\caption{An algorithm.}
\label{alg:example}
\DontPrintSemicolon
%
%%%%%%%%%%%%%%%%%%%%%
%       I/O
%%%%%%%%%%%%%%%%%%%%%

\KwInput
{
Some input.
}
%
\BlankLine

%%%%%%%%%%%%%%%%%%%%%
%       BODY
%%%%%%%%%%%%%%%%%%%%%

First step. \;
%
Second step. \;
%
Third step. \;
\end{algorithm}
\end{frame}
\end{document}


Output: