#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;

mt19937 mt(736);


template<class T>
class treap
{
	struct node
	{
		using nodeptr = node *;

		const T x;
		const unsigned y;
		nodeptr l, r;

		explicit node(T x) : x(x), y(mt()), l(nullptr), r(nullptr)
		{}

		~node()
		{
			delete l;
			delete r;
		}
	};

	using nodeptr = typename node::nodeptr;

	static nodeptr make_node(T x)
	{
		return new node(x);
	}

	static nodeptr move(nodeptr &x)
	{
		nodeptr q = x;
		x = nullptr;

		return q;
	}

	static nodeptr merge(nodeptr le, nodeptr ri)
	{
		if (le == nullptr)
			return ri;
		if (ri == nullptr)
			return le;

		if (le->y < ri->y)
		{
			auto rch = merge(move(le->r), ri);
			le->r = move(rch);

			return le;
		}
		else
		{
			auto lch = merge(le, move(ri->l));
			ri->l = move(lch);

			return ri;
		}
	}


	static pair<nodeptr, nodeptr> split(nodeptr h, const T &x)
	{
		if (h == nullptr)
			return {nullptr, nullptr};

		if (h->x < x)
		{
			auto [le, ri] = split(move(h->r), x); // structured binding, C++17

			h->r = move(le);

			return {h, ri};
		}
		else
		{
			auto [le, ri] = split(move(h->l), x);

			h->l = move(ri);

			return {le, h};
		}
	}

	nodeptr root = nullptr;

public:
	~treap()
	{
		delete root;
	}

	void insert(T x)
	{
		auto [le, ri] = split(root, x);
		root = merge(le, merge(make_node(x), ri));
	}

	bool contains(T x)
	{
		auto [le, tmp] = split(move(root), x);
		auto [mi, ri] = split(move(tmp), x + 1); // <= x

		auto ans = (mi != nullptr);

		root = merge(le, merge(mi, ri));

		return ans;
	}
};


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	treap<int> tr;

	int q;

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		char type;
		int x;

		cin >> type >> x;

		if (type == '+')
			tr.insert(x);
		else if (type == '?')
			cout << tr.contains(x) << endl;
		else
			assert(false);
	}
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	cout << fixed;

#ifdef LOCAL
	auto st = chrono::steady_clock::now();

	ifstream fin("../input.txt");

	do
	{
		solve(fin);

		cout << "===" << endl;

		string str;
		while (getline(fin, str) && str != string(max(1, (int) str.size()), '='));
	} while (fin);

#ifdef STRESS
	for (int cnt = 1;; cnt++)
	{
		stringstream ss, in1, out1, in2, out2;

		gen(ss);

		in1 << ss.str();
		in2 << ss.str();

		solve(in1, out1);
		stress(in2, out2);

		if (out1.str() != out2.str())
		{
			cout << "fail: " << cnt << endl;
			cout << ss.str();
			cout << "solve:" << endl;
			cout << out1.str();
			cout << "stress:" << endl;
			cout << out2.str();

			break;
		}
		else if (cnt % 100 == 0)
			cout << "ok: " << cnt << endl;
	}
#endif

	cout << setprecision((int) floor(log10(chrono::steady_clock::duration::period::den)));
	cout << "clock: " << chrono::duration<double>(chrono::steady_clock::now() - st).count() << endl;
#else
	solve();
#endif

	return 0;
}
