\documentclass{article}
\usepackage{cmap} % Make true russian encoding in PDF files to make russian text searchable and copyable. LOAD FIRST --- BEFORE babel, fontenc etc.! 
% Without cmap russian text in PDF has wrong encoding and will be copied like this: (anaai aa?aauaa a eano)!!!
\usepackage{mathtext} % Use russian letters in math mode. LOAD BEFORE fontenc, inputenc, babel!

\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\DeclareSymbolFont{T2Aletters}{T2A}{cmr}{m}{it} % Select font for russian letters in math mode. Load AFTER fontenc!
\usepackage[english,russian]{babel}
%\usepackage{amsmath} % amsmath not need for this example

\begin{document}

$X_{ёлок}+Y_{берёзок}=Z\quad(всего\:деревьев\:в\:лесу)$

\end{document}

% This is pure-latex hand-made document, not imported from LyX!


