Added special cases for n = 1 and n = 2