#!/usr/bin/perl -w

use strict;

local $/;
my @ads = sort { $a <=> $b } map { chomp; $_ } split /\n/, <>;

my $prev = 0;
my %diffs;
for my $n (@ads) {
	$diffs{ $n - $prev }++;
	$prev = $n;
}
$diffs{3}++;

print $diffs{1} * $diffs{3}, "\n";
