An unordered_set has immutable keys and, because of that, both the iterator and const_iterator give you const references (there's little point giving a mutable reference when the underlying thing is immutable). The use of auto picks this up because of type deduction rules.
The use of int does not allow type deduction to apply const to it (because type deduction is something that's done for auto variables). Hence you need to explicitly do that because, as you've seen, it's invalid to treat a const reference as a non-const one.
In any case, I would be using const regardless. It's usually better to be explicit in your intent - if you're not going to change a variable, make it const so that's obvious. That may also allow the compiler to make certain optimisations it may not otherwise do.
As an aside, I've just seen a nice talk from Herb Sutter (search for "Quantifying Accidental Complexity"). This is a proposal to use specifiers like in, out, inout (basically "what you want") on your function parameters rather than having to remember if it should be const, a value or reference, whether you should forward or move it within a function, and all sorts of other things ("how you want to do it").
This is another classic example of coding up intent and will, if it goes ahead, make the language a lot better in my opinion. It both removes the need to know how to do what you want, and allows the compiler to do extra checks to make sure you're following the rules (for example, ensuring every code path changes an out variable, or ensuring you don't use an out variable before assigning to it).
I'd suggest having a look if you're interested in that sort of stuff.