Count of squares that can be drawn without lifting the pencil | Function to return the count of squares that can be formed ; Driver code
def countSquares ( n ) : NEW_LINE INDENT return ( pow ( n , 2 ) - ( 2 * n ) + 2 ) ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 2 ; NEW_LINE print ( countSquares ( n ) ) ; NEW_LINE DEDENT