local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
-----------------------
local N = read.nl()
local Xs = read.l():totable()
local pop0 = 0
for i=1,N do
    if Xs[i] == "1" then
        pop0 = pop0 + 1
    end
end
if pop0 == 0 then
    os.execute("sleep 0.1")
    print(0)
    return
end
if pop0 == 1 then
    os.execute("sleep 0.2")
    print(1)
    return
end
print(-1)
