function onBegin()

end
local letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'}
function onEnd()
    local count = 0

    for _, value in ipairs(letters) do
        if getFlag("greenshard_collect_"..value) then
            count = count + 1
        end

        if getFlag("greenshard_challengerun_collect_"..value) then
            count = count + 1
        end

        if count >= 10 then

            for i = 0, 9, 1 do
                setFlag("GREENSIDE_int0"..i, true)
            end


            engine.Scene.Session:SetCounter('CHALLENGE_RUNS', count - 10)

        else

            for i = 0, count-1, 1 do
                setFlag("GREENSIDE_int0"..i, true)
            end

        end

    end
end