#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fulger.in");
ofstream g("fulger.out");
int n, i, cod, bidoane, cif, z, num;
int main()
{
f >> n;
for (i=1; i<=n; ++i)
{
f >> num;
z=1; cod=0;
while (num)
{
cif=9-num%10;
cod=cif*z+cod;
z=z*10;
num=num/10;
}
g << cod << " ";
if (cod%100==10) ++bidoane;
}
g << "\n" << bidoane;
}