For n=0,1,2,3,4 determine the pattern of the powers of n mod 5:
n=0: n to any power is 0; the remainder when divided by 5 is always 0
n=1: n to any power is 1; the remainder when divided by 5 is always 1
n=2: the pattern is 2, 4 (=-1), -2, 1 (cycle length 4)
n=3: the pattern is 3, 9 (=-1), -3, 1 (cycle length 4)
n=4: the pattern is 4 (=-1), 1 (cycle length 2)
f(n) is equal to (n^8+n^16) mod 5.
The lengths of the cycles of the remainders are 1, or 2, or 4; 8 and 16 are both multiples of all of those. So both n^8 mod 5 and n^16 mod 5 will be the last number in the pattern for each value of n.
The last numbers in the patterns are 0 for n=0 and 1 for all other values of n. So
f(0) = 0+0 = 0
f(1) = 1+1 = 2
f(2) = 1+1 = 2
f(3) = 1+1 = 2
f(4) = 1+1 = 2
f(0)+f(1)+f(2)+f(3)+f(4) = 0+2+2+2+2 = 8
ANSWER: 8
Hope it Correct!