Find how many ordered pairs of integers share only one digit Task

Your task is to make the smallest function/program that can, when gives an number N, return/print:

the number of possible choices a, b such that \$1 \leq a &lt; b &lt; N\$ and a and b have exactly one common digit in base 10 (there exists a digit, and only one digit, which appears both in a and b, for example 12 and 23, where 2 appears both in 23 and in 12)

note - 1 and 11 count as having exactly one common digit, as 1 is a digit which appears in both of them, and it's the only one that appears in both of them.

You function/program should work for all n from 1 to 1000.

Test Cases

20 -&gt; 63
40 -&gt; 267
60 -&gt; 575
80 -&gt; 987
100 -&gt; 1503
1000 -&gt; 235431


Rules

This is a code golf so the lowest score in bytes wins. Good luck!
APL (Dyalog Extended or 18.0), 24 22 bytesSBCS



Full program.

≢⍸∘.(&lt;∧1=∘≢∘∪∩⍥⍕)⍨1↓⍳⎕


Try it online!

⎕ prompt for N from the console

⍳ first N integers

1↓ drop the first one (0)

 ⍨ apply the following function using those integers as both left and right argument:

  ∘.(…) apply the following function between all combinations of left and right elements:

   ⍥⍕ stringify (make into character list) both arguments, then:

    ∩ find the intersection between the character lists

   ∪ find the Unique elements of that

   ∘ then:

    ≢ count that

   ∘ then:

    1= check if that is equal to 1

   ∧ and

   &lt; the left argument is less than the right argument

⍸ find the ɩndices of the trues

≢ count them