A set is an unordered collection of elements without duplicate entries. 

When printed, iterated or converted into a sequence, its elements will appear in an arbitrary order.

Example

>>> print set()
set([])

>>> print set('HackerRank')
set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R'])

>>> print set([1,2,1,2,3,4,5,6,0,9,12,22,3])
set([0, 1, 2, 3, 4, 5, 6, 9, 12, 22])

>>> print set((1,2,3,4,5,5))
set([1, 2, 3, 4, 5])

>>> print set(set(['H','a','c','k','e','r','r','a','n','k']))
set(['a', 'c', 'r', 'e', 'H', 'k', 'n'])

>>> print set({'Hacker' : 'DOSHI', 'Rank' : 616 })
set(['Hacker', 'Rank'])

>>> print set(enumerate(['H','a','c','k','e','r','r','a','n','k']))
set([(6, 'r'), (7, 'a'), (3, 'k'), (4, 'e'), (5, 'r'), (9, 'k'), (2, 'c'), (0, 'H'), (1, 'a'), (8, 'n')])

Basically, sets are used for membership testing and eliminating duplicate entries.

Task  

Now, let's use our knowledge of sets and help Mickey. 

Ms. Gabriel Williams is a botany professor at District College. One day, she asked her student Mickey to compute the average of all the plants with distinct heights in her greenhouse.

Formula used: $\textit{Average}=\dfrac{\textit{Sum ofDistinct Heights}}{\textit{Total Number of distinct Heights}}$

Function Description   

Complete the average function in the editor below.   

average has the following parameters:   

int arr: an array of integers    

Returns   

float: the resulting float value rounded to 3 places after the decimal   

Input Format

The first line contains the integer, $N$, the size of $\textbf{arr}$.

The second line contains the $N$ space-separated integers, $arr\left[i\right]$.

Constraints

$0<N\leq100$

Sample Input
STDIN                                       Function
-----                                       --------
10                                          arr[] size N = 10
161 182 161 154 176 170 167 171 170 174     arr = [161, 181, ..., 174]

Sample Output
169.375

Explanation

Here, set$([154,161,167,170,171,174,176,182])$ is the set containing the distinct heights. Using the sum() and len() functions, we can compute the average.

$\textit{Average}=\dfrac{1355}{8}=169.375$

Difficulty: EASY

Solutions:
n = int(input())
val = list(map(int, input().split()))
val = set(val)
print(sum(val) / len(val))


input()
H = {int(x) for x in input().split()}
print(sum(H) / len(H))


n = int(input())
li = map(int, input().split())
A = set(li)
sum1 = 0
for i in range(len(list(A))):
	sum1 += list(A)[i]
print(sum1 / len(list(A)))


input()
l = set([int(x) for x in input().split()])
print(sum(l) / len(l))


input()
l = set(map(int, input().split()))
print(sum(l) / len(l))


number_of_plants = int(input())
height = input()
height = height.split(' ')
for x in range(len(height)):
	height[x] = int(height[x])
height = set(height)
sum_distinct_height = sum(height)
total_distinct_height = len(height)
avg = sum_distinct_height / total_distinct_height
print(avg)


import sys
n = int(input())
total = 0
trees = set(map(int, sys.stdin.readline().split()))
for each_element in trees:
	total = total + each_element
average = total / len(trees)
print(average)


from functools import reduce
count = int(input())
plants = list(map(int, set(input().split())))
print(float(reduce(lambda a, b: a + b, plants)) / float(len(plants)))


i = input()
t = input()
x = list(map(int, t.split(' ')))
x = set(x)
print(sum(x) / len(x))


n = input()
s = set(map(int, input().split()))
print(sum((i for i in s)) / len(s))


N = int(input())
plants = list(map(lambda x: int(x), input().split()))
distinct_heights = set(plants)
print(sum(distinct_heights) / len(distinct_heights))


N = int(input(''))
heights = input('')
A = heights.split()
B = list(set(A))
a = 0
for i in B:
	a = a + int(i)
print(a / len(B))


n = int(input())
heights = [int(x) for x in input().split()]
distinctHeights = set(heights)
sumOfDistinctHeights = sum(distinctHeights)
lengthOfDistinctHeights = len(distinctHeights)
average = sumOfDistinctHeights / lengthOfDistinctHeights
print(average)


n = int(input())
s = set(map(int, input().split(' ')))
l = len(s)
print(sum(s) / l)


n = int(input())
plants = set(map(int, input().split()))
print(sum(plants) / len(plants))


num_plants_in_greenhouse = int(input())
plant_heights = map(int, input().split())
distinct_heights = set(plant_heights)
average = sum(distinct_heights) / len(distinct_heights)
print(average)


n = int(input())
a = set(map(int, input().split()))
print(sum(a) / len(a))


_ = input()
s = set(map(int, input().strip().split()))
print(sum(s) / len(s))


N = int(input())
a = set((int(i) for i in input().split()))
print(sum(a) / len(a))


number = int(input())
height = list(map(int, input().split()))
height = set(height)
height = list(height)
totalNum = len(height)
sumof = sum(height)
average = sumof / totalNum
print(average)


n = int(input())
l = set((elt for elt in map(int, input().split())))
s = len(set(l))
print(sum(l) / s)


N = input()
P = input().split()
I = [int(i) for i in P]
S = set(I)
numerator = sum(list(S))
denominator = len(S)
ave = float(numerator / denominator)
print(ave)


a = int(input())
b = list(map(int, input().split(' ')))
d = a
s = c = 0
for i in range(0, a):
	c = 0
	for j in range(0, a):
		if b[i] == b[j] and b[i] != 0:
			if c >= 1:
				b[j] = 0
				d -= 1
			else:
				c = c + 1
for i in range(0, a):
	s += b[i]
print(s / d)


n = int(input())
a = set((int(i) for i in input().split(' ')))
print(sum(a) / len(a))


N = int(input())
ray = map(int, input().split())
sray = set(ray)
tot = 0.0
for i in sray:
	tot += i
print(tot / len(sray))


n = int(input())
res = set(map(float, input().split()))
print(sum(res) / len(res))


input()
data = set(map(int, input().split()))
print(sum(data) / len(data))


i = int(input())
L = list(set(map(int, input().strip().split(' '))))
su = sum(L)
l = len(L)
print(su / float(l))


n = int(input())
s = map(int, set(input().split()))
num = 0
tot = 0
for h in s:
	num += 1
	tot += h
ave = tot / num
print(ave)


nplants = input()
stuff = set(map(int, input().split()))
print(sum(stuff) / len(stuff))


l = int(input())
avg = set(map(int, input().split()))
print(sum(avg) / len(avg))


int1 = int(input())
ilist = [int(el) for el in input().split()]
iset = set(ilist)
print(sum(iset) / len(iset))


n = input()
d_heights = set(map(int, input().split()))
average = sum(d_heights) / len(d_heights)
print(average)


n = input()
s = set([int(i) for i in input().split()])
print(sum(s) / len(s))


a = input()
b = set(map(int, input().split()))
print(sum(b) / len(b))


numplants = int(input().strip())
heights = set(map(int, input().strip().split()))
print(sum(heights) / len(heights))


n = int(input().strip())
hs = set(map(int, input().strip().split()[0:n]))
print(sum(hs) / len(hs))


i = int(input())
heights = set((int(x) for x in input().split()[:i]))
print(sum(heights) / len(heights))


n = input()
ar = list(map(int, input().split(' ')))
ar = set(ar)
print(sum(ar) / len(ar))


n = int(input())
heights = list(set(map(int, input().split())))
average = float(sum(heights)) / len(heights)
print(average)


N = int(input())
num = set(map(int, input().split()))
print(sum(num) / len(num))


n = int(input())
in_set = set(map(int, input().strip().split()))
print(sum(in_set) / len(in_set))


input()
li = [int(x) for x in input().split(' ')]
li = set(li)
print(float(sum(li) / len(li)))


tot = 0
cnt = 0
t = int(input())
h = input().split()
s = set(h)
for i in s:
	tot = tot + int(i)
	cnt = cnt + 1
print(tot / cnt)


input()
l = input().split()
s = []
for i in l:
	if int(i) not in s:
		s.append(int(i))
print(sum(s) / len(s))


n = int(input())
s = set(map(int, input().split()))
print(sum(s) / len(s))


input()
inp = input().split()
st = set([int(i) for i in inp])
avg = 0
for i in st:
	avg += i
avg /= len(st)
print(avg)


n = input()
s = input()
a = set(map(int, s.split()))
r = sum(a) / len(a)
print(r)


n = int(input())
x = input()
x = x.split(' ')
for i in range(n):
	x[i] = int(x[i])
a = len(set(x))
s = sum(set(x))
print(s / a)


n = input()
s = set([int(x) for x in input().split()])
print(sum(s) / len(s))


n = input()
heights = set(map(int, input().split()))
print(sum(heights) / len(heights))


a = int(input())
s = input()
sum = 0
s = set(s.split())
for i in s:
	sum = int(i) + sum
print(sum / len(s), end='')


input()
heights = set(map(int, input().split()))
print(sum(heights) / len(heights))


n = int(input())
s1 = set(map(int, input().split()))
average = sum(s1) / len(s1)
print(average)


p = int(input())
ph = [int(k) for k in input().split()]
dh = set(ph)

def sum(seta):
	s = 0
	for i in seta:
		s += i
	return s
print(sum(dh) / len(dh))


input()
S = set(map(int, input().strip().split()))
print(sum(S) / len(S))


a = int(input())
numbers = input()
numbers = set(map(int, numbers.split(' ')))
print(sum(numbers) / len(numbers))


n = int(input())
nums = list(map(int, input().split()))
s = list(set(nums))
print(sum(s) / len(s))


N = int(input())
distinct_heights = set(map(int, input().split()))
print(sum(distinct_heights) / len(distinct_heights))


total_number_of_plants = int(input())
plant_heights_input = input()
plant_heights_list = plant_heights_input.split(' ')
enumerate_plant_heights_list = list(map(int, plant_heights_list))
list_of_plant_heights = list(set(enumerate_plant_heights_list))
sum_of_plant_heights = sum(list_of_plant_heights)
number_of_plants_for_avg = len(list_of_plant_heights)
avg_plant_height = sum_of_plant_heights / number_of_plants_for_avg
print(avg_plant_height)


a = int(input())
array = set(map(int, input().split()))
print(sum(array) / len(array))


N = int(input())
S = set(map(int, input().split()))
print(round(sum(S) / len(S), 3))


num = int(input())
data = set(map(int, input().split()))
print(sum(data) / len(data))


n = int(input())
nums = set(list(map(int, input().split())))
print(sum(nums) / len(nums))


n = int(input())
heights = list(map(int, input().split()))
print(sum(set(heights)) / len(set(heights)))


T = input()
L = list(set(map(int, input().split())))
print(sum(L) / len(L))


input()
values = set([int(elem) for elem in input().split()])
print(sum(values) / len(values))


n = int(input())
numbers = set(list(map(int, input().split())))
sum = 0
for i in numbers:
	sum += i
print(sum / len(numbers))


n = int(input())
plants = set(map(int, input().split()[:n]))
print(sum(plants) / len(plants))


n = int(input().strip())
arr = set(map(int, input().strip().split()))
print(float(sum(arr) / len(arr)))


import sys
if sys.version_info[0] >= 3:
	raw_input = input
b = raw_input()
a = set(map(int, raw_input().split()))
print(sum(a) * 1.0 / len(a))


count = int(input())
heights = set(map(int, input().split()))
count_dis = len(heights)
print(sum(heights) / count_dis)


input()
heights = [int(x) for x in input().split()]
distinct_heights = set(heights)
print(sum(distinct_heights) / len(distinct_heights))


_ = input()
s = set(map(int, input().split()))
print(sum(s) / len(s))


input()
heights = input().split()
distinct_heights = set((int(h) for h in heights))
print(sum(distinct_heights) / len(distinct_heights))


slen = int(input())
lis = list(map(int, input().split()))
selis = set(lis)
lis = list(selis)
total = 0
for i in range(0, len(lis)):
	total = total + lis[i]
print(total / len(lis))


N = int(input())
s = set(list(map(int, input().split(' '))))
print(float(sum(s)) / len(s))


n = int(input())
A = set([float(x) for x in input().split()])
denom = len(A)
numer = sum(A)
print(numer / denom)


in1 = input('')
set1 = set(map(int, input('').split(' ')))
sum1 = sum(set1)
len1 = len(set1)
print(sum1 / len1)


input()
n = set([float(x) for x in input().split(' ')])
print(sum(n) / len(n))


input()
x = set(map(int, input().split()))
print(sum(x) / len(x))


n = input()
n = float(n)
s = input()
d = list(map(int, s.split()))
se = set(d)
avg = sum(se) / float(len(se))
print(avg)


num = int(input())
vals = set(map(int, input().split()))
print(sum(vals) / len(vals))


def main():
	n = int(input())
	xs = set([int(x) for x in input().split(' ')])
	print('%.3f' % (sum(xs) / len(xs)))
main()


k = int(input())
a = {int(i) for i in input().split(' ')}
print(sum(a) / len(a))


N = int(input())
s = set(map(int, input().split()))
print(sum(s) / len(s))


a = int(input())
b = input().split()
c = set([float(i) for i in b])
d = 0
for i in c:
	d += i
avg = d / len(c)
print(avg)


n = input()
s = set(map(int, input().split()))
avg = sum(s) / float(len(s))
print('{0:.3f}'.format(avg))


import sys
nb_v = int(input())
print('nb_v', nb_v, file=sys.stderr)
line = input()
arr = [int(x) for x in line.split()]
print('set_', set(arr), file=sys.stderr)
print(sum(set(arr)) / len(set(arr)))


n = int(input())
S = set(map(int, input().split()))
tot = 0
for i in S:
	tot += i
print(tot / len(S))


_ = input()
A = set(map(int, input().split()))
res = sum(A) / len(A)
print(res)


t = int(input())
s = set(map(int, input().split(' ')))
print(float(sum(s)) / len(s))


n = int(input())
h = set(map(int, input().split()))
print(sum(h) / len(h))


n = input()
n = [float(i) for i in input().split(' ')]
s = set(n)
sum = 0.0
for i in s:
	sum += i
print(sum / len(s))


input()
plants = set([int(x) for x in input().split()])
print(sum(plants) / len(plants))


import functools
n = int(input())
s = list(set(map(int, input().split())))
print(functools.reduce(lambda x, y: x + y, s) / len(s))


input()
a = set(map(int, input().split()))
print(sum(a) / len(a))