# -*- coding: utf-8 -*-

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092

"""

import sys





def find_square0(data):

    max_size = 0

    dp = [] # dp??¨???2?¬??????????

    # '.'????????????1??????'*'????????????0????????????

    for row in data:

        temp = []

        for c in row:

            if c == '.':

                temp.append(1)

            else:

                temp.append(0)

        dp.append(temp)



    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????

    for y in range(1, len(dp)):

        for x in range(1, len(dp[0])):

            if dp[y][x] == 1:

                dp[y][x] = min(dp[y-1][x-1], dp[y-1][x], dp[y][x-1]) + 1

                if dp[y][x] > max_size:

                    max_size = dp[y][x]

    return max_size





def find_square2(data):

    max_size = 0

    dp = [[0]*len(data[0]) for _ in range(len(data))] # dp??¨???2?¬???????????????¨??????0??§?????????

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y][x] = 1



    # (?????¨???(curr_row)??¨???????????????(prev_row)????????¢????????????????????§?????????????????????)

    prev_row = dp[0]

    for curr_row in dp[1:]:

        for x, t in enumerate(curr_row[1:], start=1):

            if t == 1:

                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1

                if curr_row[x] > max_size:

                    max_size = curr_row[x]

        prev_row = curr_row

    return max_size





def find_square3(data):

    from array import array

    max_size = 0

    dp = [array('I', [0]*len(data[0])) for _ in range(len(data))]  # ????¬?????????????array??????????????§?¢????

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y][x] = 1



    prev_row = dp[0]

    for curr_row in dp[1:]:

        for x, t in enumerate(curr_row[1:], start=1):

            if t == 1:

                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1

                if curr_row[x] > max_size:

                    max_size = curr_row[x]

        prev_row = curr_row

    return max_size





def find_square4(data):

    max_size = 0

    dp = [0 for _ in range(1024*1024)]

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y*1024+x] = 1



    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????

    for y in range(1, len(data)):

        for x in range(1, len(data)):

            if dp[y*1024+x] == 1:

                dp[y*1024+x] = min(dp[(y-1)*1024+x-1], dp[(y-1)*1024+x], dp[y*1024+x-1]) + 1

                if dp[y*1024+x] > max_size:

                    max_size = dp[y*1024+x]

    return max_size







def main(args):

    while True:

        n = int(eval(input()))

        if n == 0:

            break

        data = [eval(input()) for _ in range(n)]

        result = find_square4(data)

        print(result)





if __name__ == '__main__':

    main(sys.argv[1:])
# -*- coding: utf-8 -*-

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092

"""

import sys





def find_square0(data):

    max_size = 0

    dp = [] # dp??¨???2?¬??????????

    # '.'????????????1??????'*'????????????0????????????

    for row in data:

        temp = []

        for c in row:

            if c == '.':

                temp.append(1)

            else:

                temp.append(0)

        dp.append(temp)



    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????

    for y in range(1, len(dp)):

        for x in range(1, len(dp[0])):

            if dp[y][x] == 1:

                dp[y][x] = min(dp[y-1][x-1], dp[y-1][x], dp[y][x-1]) + 1

                if dp[y][x] > max_size:

                    max_size = dp[y][x]

    return max_size





def find_square2(data):

    max_size = 0

    dp = [[0]*len(data[0]) for _ in range(len(data))] # dp??¨???2?¬???????????????¨??????0??§?????????

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y][x] = 1



    # (?????¨???(curr_row)??¨???????????????(prev_row)????????¢????????????????????§?????????????????????)

    prev_row = dp[0]

    for curr_row in dp[1:]:

        for x, t in enumerate(curr_row[1:], start=1):

            if t == 1:

                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1

                if curr_row[x] > max_size:

                    max_size = curr_row[x]

        prev_row = curr_row

    return max_size





def find_square3(data):

    from array import array

    max_size = 0

    dp = [array('I', [0]*len(data[0])) for _ in range(len(data))]  # ????¬?????????????array??????????????§?¢????

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y][x] = 1



    prev_row = dp[0]

    for curr_row in dp[1:]:

        for x, t in enumerate(curr_row[1:], start=1):

            if t == 1:

                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1

                if curr_row[x] > max_size:

                    max_size = curr_row[x]

        prev_row = curr_row

    return max_size





def find_square4(data):

    # 4.91[s]

    max_size = 0

    dp = [0 for _ in range(1024*1024)]

    # '.'????????????1???

    for y, row in enumerate(data):

        for x, c in enumerate(row):

            if c == '.':

                dp[y*1024+x] = 1



    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????

    for y in range(1, len(data)):

        for x in range(1, len(data)):

            if dp[y*1024+x] == 1:

                dp[y*1024+x] = min(dp[(y-1)*1024+x-1], dp[(y-1)*1024+x], dp[y*1024+x-1]) + 1

                if dp[y*1024+x] > max_size:

                    max_size = dp[y*1024+x]

    return max_size







def main(args):

    while True:

        n = int(eval(input()))

        if n == 0:

            break

        data = [eval(input()) for _ in range(n)]

        result = find_square0(data)

        print(result)





if __name__ == '__main__':

    main(sys.argv[1:])
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys


def find_square0(data):
    max_size = 0
    dp = []  # dp??¨???2?¬??????????
    # '.'????????????1??????'*'????????????0????????????
    for row in data:
        temp = []
        for c in row:
            if c == ".":
                temp.append(1)
            else:
                temp.append(0)
        dp.append(temp)
    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(dp)):
        for x in range(1, len(dp[0])):
            if dp[y][x] == 1:
                dp[y][x] = min(dp[y - 1][x - 1], dp[y - 1][x], dp[y][x - 1]) + 1
                if dp[y][x] > max_size:
                    max_size = dp[y][x]
    return max_size


def find_square2(data):
    max_size = 0
    dp = [
        [0] * len(data[0]) for _ in range(len(data))
    ]  # dp??¨???2?¬???????????????¨??????0??§?????????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y][x] = 1
    # (?????¨???(curr_row)??¨???????????????(prev_row)????????¢????????????????????§?????????????????????)
    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x - 1], prev_row[x], curr_row[x - 1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square3(data):
    from array import array

    max_size = 0
    dp = [
        array("I", [0] * len(data[0])) for _ in range(len(data))
    ]  # ????¬?????????????array??????????????§?¢????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y][x] = 1
    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x - 1], prev_row[x], curr_row[x - 1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square4(data):
    max_size = 0
    dp = [0 for _ in range(1024 * 1024)]
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y * 1024 + x] = 1
    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(data)):
        for x in range(1, len(data)):
            if dp[y * 1024 + x] == 1:
                dp[y * 1024 + x] = (
                    min(
                        dp[(y - 1) * 1024 + x - 1],
                        dp[(y - 1) * 1024 + x],
                        dp[y * 1024 + x - 1],
                    )
                    + 1
                )
                if dp[y * 1024 + x] > max_size:
                    max_size = dp[y * 1024 + x]
    return max_size


def main(args):
    while True:
        n = int(eval(input()))
        if n == 0:
            break
        data = [eval(input()) for _ in range(n)]
        result = find_square4(data)
        print(result)


if __name__ == "__main__":
    main(sys.argv[1:])

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys


def find_square0(data):
    max_size = 0
    dp = []  # dp??¨???2?¬??????????
    # '.'????????????1??????'*'????????????0????????????
    for row in data:
        temp = []
        for c in row:
            if c == ".":
                temp.append(1)
            else:
                temp.append(0)
        dp.append(temp)
    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(dp)):
        for x in range(1, len(dp[0])):
            if dp[y][x] == 1:
                dp[y][x] = min(dp[y - 1][x - 1], dp[y - 1][x], dp[y][x - 1]) + 1
                if dp[y][x] > max_size:
                    max_size = dp[y][x]
    return max_size


def find_square2(data):
    max_size = 0
    dp = [
        [0] * len(data[0]) for _ in range(len(data))
    ]  # dp??¨???2?¬???????????????¨??????0??§?????????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y][x] = 1
    # (?????¨???(curr_row)??¨???????????????(prev_row)????????¢????????????????????§?????????????????????)
    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x - 1], prev_row[x], curr_row[x - 1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square3(data):
    from array import array

    max_size = 0
    dp = [
        array("I", [0] * len(data[0])) for _ in range(len(data))
    ]  # ????¬?????????????array??????????????§?¢????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y][x] = 1
    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x - 1], prev_row[x], curr_row[x - 1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square4(data):
    # 4.91[s]
    max_size = 0
    dp = [0 for _ in range(1024 * 1024)]
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == ".":
                dp[y * 1024 + x] = 1
    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(data)):
        for x in range(1, len(data)):
            if dp[y * 1024 + x] == 1:
                dp[y * 1024 + x] = (
                    min(
                        dp[(y - 1) * 1024 + x - 1],
                        dp[(y - 1) * 1024 + x],
                        dp[y * 1024 + x - 1],
                    )
                    + 1
                )
                if dp[y * 1024 + x] > max_size:
                    max_size = dp[y * 1024 + x]
    return max_size


def main(args):
    while True:
        n = int(eval(input()))
        if n == 0:
            break
        data = [eval(input()) for _ in range(n)]
        result = find_square0(data)
        print(result)


if __name__ == "__main__":
    main(sys.argv[1:])

+    # 4.91[s] -        result = find_square4(data) +        result = find_square0(data)