The Partition Function of 2D String Theory