x = 0 for i in range(1,1001): if i % 7 != 0 and i %3 !=0 and i %5 != 0: x = x+1 print x