#!/usr/bin/python
# coding: utf-8

class Solution(object):
        def isPowerOfThree(self, n):
            """
            :type n: int
            :rtype: bool
            """
            return n > 0 and 1162261467 % n == 0;
