#include <iostream>
using namespace std;
template <int First, int... Numbers>
inline bool in_impl(int n)
{
return n == First || in_impl<Numbers...>(n);
}
template <>
inline bool in_impl<int(0)>(int n)
{
return false;
}
template <int... Numbers>
inline bool in(int n)
{
return in_impl<Numbers..., int(0)>(n);
}
enum E { E1, E2, E3, E4 };
int main() {
std::cout << in<3, 5, 7, 9>(4) << '\n';
std::cout << in<3, 5, 7, 9>(5) << '\n';
std::cout << in<E2, E4>(E1) << '\n';
std::cout << in<E2, E4>(E2) << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPGludCBGaXJzdCwgaW50Li4uIE51bWJlcnM+CmlubGluZSBib29sIGluX2ltcGwoaW50IG4pCnsKICAgIHJldHVybiBuID09IEZpcnN0IHx8IGluX2ltcGw8TnVtYmVycy4uLj4obik7Cn0KCnRlbXBsYXRlIDw+CmlubGluZSBib29sIGluX2ltcGw8aW50KDApPihpbnQgbikKewoJcmV0dXJuIGZhbHNlOwp9Cgp0ZW1wbGF0ZSA8aW50Li4uIE51bWJlcnM+CmlubGluZSBib29sIGluKGludCBuKSAKewoJcmV0dXJuIGluX2ltcGw8TnVtYmVycy4uLiwgaW50KDApPihuKTsKfQoKZW51bSBFIHsgRTEsIEUyLCBFMywgRTQgfTsKCmludCBtYWluKCkgewoJc3RkOjpjb3V0IDw8IGluPDMsIDUsIDcsIDk+KDQpIDw8ICdcbic7CglzdGQ6OmNvdXQgPDwgaW48MywgNSwgNywgOT4oNSkgPDwgJ1xuJzsKCXN0ZDo6Y291dCA8PCBpbjxFMiwgRTQ+KEUxKSA8PCAnXG4nOwoJc3RkOjpjb3V0IDw8IGluPEUyLCBFND4oRTIpIDw8ICdcbic7Cn0=