  We analyze a class of quantum-critical models, in which momentum integration
and the selection of a particular pairing symmetry can be done explicitly, and
the competition between non-Fermi liquid and pairing can be analyzed within an
effective model with dynamical electron-electron interaction $V(\Omega_m)\sim
1/|\Omega_m|^\gamma$ (the $\gamma$-model). In this paper, the first in the
series, we consider the case $T=0$ and $0<\gamma <1$. We argue that tendency to
pairing is stronger, and the ground state is a superconductor. We argue,
however, that superconducting state is highly non-trivial as there exists a
discrete set of topologically distinct solutions for the pairing gap $\Delta_n
(\omega_m)$ ($n = 0, 1, 2..., \infty$). All solutions have the same spatial
pairing symmetry, but differ in the time domain: $\Delta_n (\omega_m)$ changes
sign $n$ times as a function of Matsubara frequency $\omega_m$. The $n =0$
solution $\Delta_0 (\omega_m)$ is sign-preserving and tends to a finite value
at $\omega_m =0$, like in BCS theory. The $n = \infty$ solution corresponds to
an infinitesimally small $\Delta (\omega_m)$. As a proof, we obtain the exact
solution of the linearized gap equation at $T=0$ on the entire frequency axis
for all $0<\gamma <1$, and an approximate solution of the non-linear gap
equation.We argue that the presence of an infinite set of solutions opens up a
new channel of gap fluctuations. We extend the analysis to the case where the
pairing component of the interaction has additional factor $1/N$ and show that
there exists a critical $N_{cr} >1$, above which superconductivity disappears,
and the ground state becomes a non-Fermi liquid.We show that all solutions
develop simultaneously once $N$ gets smaller than $N_{cr}$.
