<p>On a social network consisting of <code>m</code> users and some friendships between users, two users can communicate with each other if they know a common language.</p>
<p>You are given an integer <code>n</code>, an array <code>languages</code>, and an array <code>friendships</code> where:</p>
<ul>
<li>There are <code>n</code> languages numbered <code>1</code> through <code>n</code>,</li>
<li><code>languages[i]</code> is the set of languages the <code>i<sup>th</sup></code> user knows, and</li>
<li><code>friendships[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> denotes a friendship between the users <code>u<sup></sup><sub>i</sub></code> and <code>v<sub>i</sub></code>.</li>
</ul>
<p>You can choose <strong>one</strong> language and teach it to some users so that all friends can communicate with each other. Return <idata-stringify-type="italic">the</i><i><strong>minimum</strong></i><idata-stringify-type="italic">number of users you need to teach.</i></p>
Note that friendships are not transitive, meaning if <code>x</code> is a friend of <code>y</code> and <code>y</code> is a friend of <code>z</code>, this doesn't guarantee that <code>x</code> is a friend of <code>z</code>.