F-curve modifier animation - whole values only
In order to have the f-curve follow precice values (eg, to follow exactly to the frame number) you can use f-curve modifiers to generate the values mathematically.

To achieve this, you first need to add a keyframe to your property to create the f-curve and then view the properties in the Graph Editor (N).

In the Modifiers section, click Add Modifier and select Generator. 



The Generator allows you to define an equation to assign a value for the f-curve (y) for each frame (x) as a polynomial equation. For a 'straight line' relationship you need a '1st order' polynomial - so set Poly Order to '1'.

For the value to always equal the frame number you need to define it as y = 0 + 1x (ie, `y=x') - so set the first parameter to '0.0' and the second to '1.0'.

By ensuring the parameters are integers the result will be an integer for any integer frame number.

You can use this same technique to generate values for more complicated scenarios - for example, to set only for a particular range of frames (enable 'Restrict Frame Range') or to jump multiple values per frame (eg, y = 0 + 5x would increment the value by '5' for each frame) or to use a higher-level polynomial for non-linear relationships.