Nondestructive detector for exchange symmetry of photonic qubits