Closed-Form Expressions for the n-Queens Problem and Related Problems. (12th July 2017)