Width of the posts is irrelevant.
Figure distance between post centers in inches = 12L
Total number of inches occupied by the boards= N*A
Assuming the terminal boards are centered on the fence posts, add A inches to 12L
Therefore, total distance spanned by N boards is 12L + A
Subtract Total number of inches occupied by boards from total inches spanned: (12L +A) - N*A
The only way this might vary would depend on the way the terminal boards are centered or not centered on the posts.