int input kv3 kv kpar buf int input for in range for in range int inpu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n = int(input())
kv3 = 0
kv = 0
kpar = 0
buf = [int(input()) for i in range(4)]
for i in range(4, n):
a = int(input())
b = buf[0]; buf = buf[1:] + [a]; print(buf)
kv3 += int(b%3 == 0); kv += int(b%3 != 0)
if a % 3 == 0:
kpar += kv
else:
kpar += kv3
print(kpar)