def sum_power(n):
    """Sums digits of 2^n."""
    digits = [2]
    for _ in range(n-1):
        for i in range(len(digits)-1, -1, -1):
            d = digits[i]
            if 2*d > 9:
                digits[i] = (2*d)%10
                if i == len(digits)-1:
                    digits.append((2*d) // 10)
                else:
                    digits[i+1] += (2*d) // 10
            else:
                digits[i] = 2*d
    return sum(digits)