  Aims. Deep millimeter surveys are necessary to probe the dust-obscured
galaxies at high redshift. We conducted a large observing program at 1.2 and 2
mm with the NIKA2 camera installed on the IRAM 30-meter telescope. This NIKA2
Cosmological Legacy Survey (N2CLS) covers two emblematic fields: GOODS-N and
COSMOS. We introduce the N2CLS survey and present new 1.2 and 2 mm number count
measurements based on the tiered N2CLS observations from October 2017 to May
2021.
  Methods. We develop an end-to-end simulation that combines an input sky model
with the instrument noise and data reduction pipeline artifacts. This
simulation is used to compute the sample purity, flux boosting, pipeline
transfer function, completeness, and effective area of the survey. We used the
117 deg$^2$ SIDES simulations as the sky model, which include the galaxy
clustering. Our formalism allows us to correct the source number counts to
obtain galaxy number counts, the difference between the two being due to
resolution effects caused by the blending of several galaxies inside the large
beam of single-dish instruments.
  Results. The N2CLS-May2021 survey reaches an average 1-$\sigma$ noise level
of 0.17 and 0.048 mJy on GOODS-N over 159 arcmin$^2$, and 0.46 and 0.14 mJy on
COSMOS over 1010 arcmin$^2$, at 1.2 and 2 mm, respectively. For a purity
threshold of 80%, we detect 120 and 67 sources in GOODS-N and 195 and 76
sources in COSMOS, at 1.2 and 2 mm, respectively. Our measurement connects the
bright single-dish to the deep interferometric number counts. After correcting
for resolution effects, our results reconcile the single-dish and
interferometric number counts and are further accurately compared with model
predictions.
