Reconstructing the inflationary f(R) from observations