Characterization of n-vertex graphs with metric‎‎ dimension n-3