Explicație:
int n, nr = 0;
cin >> n;
while(n != 0)
{
int ogl = 0;
int aux = n;
while(aux != 0)
{
ogl = ogl * 10 + aux % 10;
aux /= 10;
}
int a = n, b = ogl;
while(b != 0)
{
int r = a % b;
a = b;
b = r;
}
if(a == 1)
nr++;
cin >> n;
}
cout << nr;
return 0;