1def SeatingStudents(arr):
2
3 K = arr[0]
4 occupied = arr[1:]
5
6 rows = int(K/2)
7
8 seats = []
9 x = 0
10
11 for i in range(rows):
12 seats.append([])
13 for j in range(2):
14 if((x+1) in occupied):
15 full_seat = True
16 else:
17 full_seat = False
18 seats[i].append(str(full_seat))
19 x+=1
20
21 seating = 0
22 for i in range(rows-1):
23 if((seats[i][0] == str(False)) and (seats[i][1] == str(False))):
24 seating+=1
25
26 if((seats[i][0] == str(False)) and (seats[i+1][0] == str(False))):
27 seating+=1
28
29 if((seats[i][1] == str(False)) and (seats[i + 1][1] == str(False))):
30 seating+=1
31
32 if((seats[rows - 1][0] == str(False)) and (seats[rows - 1][1] == str(False))):
33 seating+=1
34 return seating
35
36
37print(SeatingStudents([12, 2, 6, 7, 11]))