import std.stdio; import std.conv; import std.string; void main(){ auto N = readln.chomp.to!int; auto A = readln.chomp.split.to!(int[]); auto count = new ulong[8]; foreach(a; A){ count[a - 1]++; } ulong result = 0; for(ulong i = 0; i < 8; i++){ for(ulong j = 0; j < 8; j++){ result += (i + 1) ^^ (j + 1) * count[i] * count[j]; } } result.writeln; }