Choose the maximum spacing you want to stay under, then divide each straight segment into equal spans. The actual span can be shorter than your maximum but should not be longer.
End, corner, and gate posts are terminal conditions, not extra line posts. A rectangular layout counts four corners once.
Review before buying
Check the layout against gates, grade changes, and the selected fencing system. This is a material planning estimate, not installation or code approval.