import std.stdio;
import std.string;
import std.conv;
import std.typecons;

alias Tp = Tuple;


int bitcnt(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

void main() {
	auto n = readln.chomp.to!int;
	auto a = new Tp!(int, bool)[n];
	foreach (i; 0..n) {
		int ai;
		scanf("%d", &ai); 
		a[i] = tuple(ai, false);
	}
	for (size_t i; i < a.length; ++i) {
		for (size_t j = i + 1; j < a.length; ++j) {
			if (bitcnt(a[i][0] + a[j][0]) == 1) {
				a[i][1] = true;
				a[j][1] = true;
			}
		}
	}
	size_t c;
	foreach (ai; a) {
		if (ai[1]) ++c;
	}
	write(c/2);
}
