from functools import reduce


def solve(n, ar):
    """
    Given an integer array of size n, return the sum of all its elements.
    """
    # We could explicitly iterate over each element the array, but in python,
    # we can just use the reduce() function to sum up a list of numbers.
    return reduce((lambda x, y: x + y), ar)