When you get to using [count]g[something] and g[count][something] and <C-@>[count]g[something] etc a lot, you start getting a bit confused about where you need to put the count to make things work. So you can make putting the count anywhere work; now, don't worry and just start pressing g or <C-@>g for window actions, and put a count if you realise you need it:

map <expr> <C-@>1 Termcountmap(1, "")
map <expr> <C-@>2 Termcountmap(2, "")
map <expr> <C-@>3 Termcountmap(3, "")
map <expr> <C-@>4 Termcountmap(4, "")
map <expr> <C-@>5 Termcountmap(5, "")
map <expr> <C-@>6 Termcountmap(6, "")
map <expr> <C-@>7 Termcountmap(7, "")
map <expr> <C-@>8 Termcountmap(8, "")
map <expr> <C-@>9 Termcountmap(9, "")
map! <expr> <C-@>1 Termcountmap(1, '<Esc>')
map! <expr> <C-@>2 Termcountmap(2, '<Esc>')
map! <expr> <C-@>3 Termcountmap(3, '<Esc>')
map! <expr> <C-@>4 Termcountmap(4, '<Esc>')
map! <expr> <C-@>5 Termcountmap(5, '<Esc>')
map! <expr> <C-@>6 Termcountmap(6, '<Esc>')
map! <expr> <C-@>7 Termcountmap(7, '<Esc>')
map! <expr> <C-@>8 Termcountmap(8, '<Esc>')
map! <expr> <C-@>9 Termcountmap(9, '<Esc>')
tmap <expr> <C-@>1 Termcountmap(1, '<C-@>N')
tmap <expr> <C-@>2 Termcountmap(2, '<C-@>N')
tmap <expr> <C-@>3 Termcountmap(3, '<C-@>N')
tmap <expr> <C-@>4 Termcountmap(4, '<C-@>N')
tmap <expr> <C-@>5 Termcountmap(5, '<C-@>N')
tmap <expr> <C-@>6 Termcountmap(6, '<C-@>N')
tmap <expr> <C-@>7 Termcountmap(7, '<C-@>N')
tmap <expr> <C-@>8 Termcountmap(8, '<C-@>N')
tmap <expr> <C-@>9 Termcountmap(9, '<C-@>N')

function! Termcountmap(initcount, normalkeys)
let termcount = a:initcount
while 1
try
let char = getchar()
catch /^Vim:Interrupt$/
return ""
endtry

if type(char) == 0
let char = nr2char(char)
endif

if char == '0'
let termcount = termcount * 10
elseif char == '1'
let termcount = termcount * 10 + 1
elseif char == '2'
let termcount = termcount * 10 + 2
elseif char == '3'
let termcount = termcount * 10 + 3
elseif char == '4'
let termcount = termcount * 10 + 4
elseif char == '5'
let termcount = termcount * 10 + 5
elseif char == '6'
let termcount = termcount * 10 + 6
elseif char == '7'
let termcount = termcount * 10 + 7
elseif char == '8'
let termcount = termcount * 10 + 8
elseif char == '9'
let termcount = termcount * 10 + 9
elseif char == 'g'
return a:normalkeys .. termcount .. 'g'
elseif char == "\<C-g>"
return a:normalkeys .. termcount .. "\<C-@>\<C-g>"
elseif char == 'w'
return a:normalkeys .. termcount .. "\<C-@>w"
elseif char == 'W'
return a:normalkeys .. termcount .. "\<C-@>W"
elseif char == 't'
return a:normalkeys .. termcount .. "\<C-@>t"
elseif char == 'b'
return a:normalkeys .. termcount .. "\<C-@>b"
else
return a:normalkeys .. ":\<C-u>" .. termcount .. ' wincmd ' .. char .. "\<CR>\<C-l>"
endif

endwhile
endfunction

map <expr> g<C-@> <C-@>g

map <expr> g1 Prefixcountmap (v:count * 10 + 1, "", 'g')
map <expr> g2 Prefixcountmap (v:count * 10 + 2, "", 'g')
map <expr> g3 Prefixcountmap (v:count * 10 + 3, "", 'g')
map <expr> g4 Prefixcountmap (v:count * 10 + 4, "", 'g')
map <expr> g5 Prefixcountmap (v:count * 10 + 5, "", 'g')
map <expr> g6 Prefixcountmap (v:count * 10 + 6, "", 'g')
map <expr> g7 Prefixcountmap (v:count * 10 + 7, "", 'g')
map <expr> g8 Prefixcountmap (v:count * 10 + 8, "", 'g')
map <expr> g9 Prefixcountmap (v:count * 10 + 9, "", 'g')
tmap <expr> <c-@>g1 Prefixcountmap (v:count * 10 + 1, '<c-@>n', 'g')
tmap <expr> <c-@>g2 Prefixcountmap (v:count * 10 + 2, '<c-@>n', 'g')
tmap <expr> <c-@>g3 Prefixcountmap (v:count * 10 + 3, '<c-@>n', 'g')
tmap <expr> <c-@>g4 Prefixcountmap (v:count * 10 + 4, '<c-@>n', 'g')
tmap <expr> <c-@>g5 Prefixcountmap (v:count * 10 + 5, '<c-@>n', 'g')
tmap <expr> <c-@>g6 Prefixcountmap (v:count * 10 + 6, '<c-@>n', 'g')
tmap <expr> <c-@>g7 Prefixcountmap (v:count * 10 + 7, '<c-@>n', 'g')
tmap <expr> <c-@>g8 Prefixcountmap (v:count * 10 + 8, '<c-@>n', 'g')
tmap <expr> <c-@>g9 Prefixcountmap (v:count * 10 + 9, '<c-@>n', 'g')

map <expr> <C-@><C-g>1 Prefixcountmap (v:count * 10 + 1, "", '<C-@><C-g>')
map <expr> <C-@><C-g>2 Prefixcountmap (v:count * 10 + 2, "", '<C-@><C-g>')
map <expr> <C-@><C-g>3 Prefixcountmap (v:count * 10 + 3, "", '<C-@><C-g>')
map <expr> <C-@><C-g>4 Prefixcountmap (v:count * 10 + 4, "", '<C-@><C-g>')
map <expr> <C-@><C-g>5 Prefixcountmap (v:count * 10 + 5, "", '<C-@><C-g>')
map <expr> <C-@><C-g>6 Prefixcountmap (v:count * 10 + 6, "", '<C-@><C-g>')
map <expr> <C-@><C-g>7 Prefixcountmap (v:count * 10 + 7, "", '<C-@><C-g>')
map <expr> <C-@><C-g>8 Prefixcountmap (v:count * 10 + 8, "", '<C-@><C-g>')
map <expr> <C-@><C-g>9 Prefixcountmap (v:count * 10 + 9, "", '<C-@><C-g>')
map! <expr> <C-@><C-g>1 Prefixcountmap (v:count * 10 + 1, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>2 Prefixcountmap (v:count * 10 + 2, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>3 Prefixcountmap (v:count * 10 + 3, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>4 Prefixcountmap (v:count * 10 + 4, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>5 Prefixcountmap (v:count * 10 + 5, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>6 Prefixcountmap (v:count * 10 + 6, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>7 Prefixcountmap (v:count * 10 + 7, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>8 Prefixcountmap (v:count * 10 + 8, '<Esc>', '<C-@><C-g>')
map! <expr> <C-@><C-g>9 Prefixcountmap (v:count * 10 + 9, '<Esc>', '<C-@><C-g>')
tmap <expr> <C-@><C-g>1 Prefixcountmap (v:count * 10 + 1, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>2 Prefixcountmap (v:count * 10 + 2, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>3 Prefixcountmap (v:count * 10 + 3, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>4 Prefixcountmap (v:count * 10 + 4, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>5 Prefixcountmap (v:count * 10 + 5, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>6 Prefixcountmap (v:count * 10 + 6, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>7 Prefixcountmap (v:count * 10 + 7, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>8 Prefixcountmap (v:count * 10 + 8, '<C-@>N', '<C-@><C-g>')
tmap <expr> <C-@><C-g>9 Prefixcountmap (v:count * 10 + 9, '<C-@>N', '<C-@><C-g>')

function! Prefixcountmap(initcount, prefix, countprefix)
let termcount = a:initcount
while 1
try
let char = getchar()
catch /^Vim:Interrupt$/
return ""
endtry

if type(char) == 0
let char = nr2char(char)
endif

if char == '0'
let termcount = termcount * 10
elseif char == '1'
let termcount = termcount * 10 + 1
elseif char == '2'
let termcount = termcount * 10 + 2
elseif char == '3'
let termcount = termcount * 10 + 3
elseif char == '4'
let termcount = termcount * 10 + 4
elseif char == '5'
let termcount = termcount * 10 + 5
elseif char == '6'
let termcount = termcount * 10 + 6
elseif char == '7'
let termcount = termcount * 10 + 7
elseif char == '8'
let termcount = termcount * 10 + 8
elseif char == '9'
let termcount = termcount * 10 + 9
else
return a:prefix .. termcount .. a:countprefix .. char
endif

endwhile
endfunction