P=NP when number of input that gives 1 is bounded by polynomial


Suppose there exists some NP-complete problem such that the number of inputs that gives 1 as an output is bounded by a polynomial; that is, if the problem is $ f : \{0, 1 \}^* \to \{0, 1\}$ , then, for every $ n$ , $ |\{ x \in \{0, 1 \}^n : f(x) = 1\}| \leq p(n)$ for some polynomial $ p$ . Then, I want to show that the existence of this problem implies $ P = NP$ . Is it somehow related to LEXSAT?