﻿from sympy import *

c=0
for k in range(0,1000):
    if gcd(3*k+1,5*k+2)==1:
        c=c+1
print(c)


