How many functions are there from the set {1, 2, . . . , n}, where n is a positive integer, to the set {0, 1}

a) that are one-to-one?

b) that assign 0 to both 1 and n?

c) that assign 1 to exactly one of the positive integers less than n?

For a) my answer is 2 if n = 1 or n = 2 and 0 if n > 2.

But I'm stuck on both b) and c). Any help would be appreciated.