\count1=4 \countdef\columns=1
\def\subpre{
  & ##
  \advance\columns by -1 \ifnum\columns>0 \span\subpre \fi
}
\def\preamb{
  ##
  \advance \columns by -1
  \the\columns
  \ifnum\columns>0 \span\subpre \fi
  \cr
}
\halign{\span\preamb
  first line \cr
  second line \cr
  third line \cr
}
\bye
