gcd = lambda x, y: y == 0 and x or gcd(y, x % y) total = 0 for i in xrange(12001): for j in xrange(i / 3 + 1, i / 2 + i % 2): if gcd(i, j) == 1: total += 1 print total