<p>Given a list of <code>dominoes</code>, <code>dominoes[i] = [a, b]</code> is <strong>equivalent to</strong><code>dominoes[j] = [c, d]</code> if and only if either (<code>a == c</code> and <code>b == d</code>), or (<code>a == d</code> and <code>b == c</code>) - that is, one domino can be rotated to be equal to another domino.</p>
<p>Return <em>the number of pairs </em><code>(i, j)</code><em> for which </em><code>0 <= i < j < dominoes.length</code><em>, and </em><code>dominoes[i]</code><em> is <strong>equivalent to</strong></em><code>dominoes[j]</code>.</p>