#include <iostream>
#include <vector>

typedef std::vector<bool> vb;

int base10(const vb &value)
{
	int result = 0;
	int bit = 1;

	for (vb::const_reverse_iterator b = value.rbegin(), e = value.rend(); b != e; ++b, bit <<= 1)
		result += (*b ? bit : 0);

	return result;	
}

int main()
{
	vb value1({1, 0, 1}); // 5
	vb value2({1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1}); // 5

	std::cout << base10(value1) << '\n' << base10(value2);

	return 0;
}