import sequtils, sets, strutils

let
  n = parseInt readLine stdin
  xs = n.newSeqWith readLine stdin
var
  ss: seq[string]

for i in 0 ..< n.pred:
  for j in i.succ ..< n:
    ss.add(xs[i] & xs[j])
    ss.add(xs[j] & xs[i])

echo ss.toHashSet.card