N=gets.to_i

ary = []
buf = ""
counter = 0
pairs = []

N.times do |i|
  n = gets.to_i
  if n != buf
    ary << n
  end
  buf = n
end

ary.each_with_index do |m, i|
  ary[i..-1].each_with_index do |n, j|
    if m == n && i < j
      pairs << [i, j]
      counter += 1
    end
  end
end

pairs.permutation(2).to_a.each do |pair|
  if pair[0][1] < pair[1][0]
    counter += 1
  end
end

puts(counter + 1)
