Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    # bにチェックする数を追加していく
    b = []
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        flag = True
        for j in b:
            if a[i] % j == 0:
                flag = False
                break

        if flag:
            b.append(a[i])
            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()


Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    # bにチェックする数を追加していく
    b = []
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        flag = True
        for j in b:
            if j * 2 > a[i]:
                break
            if a[i] % j == 0:
                flag = False
                break

        if flag:
            b.append(a[i])
            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    # bにチェックする数を追加していく
    b = []
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        flag = True
        for j in b:
            if j * 2 > a[i]:
                break
            if a[i] % j == 0:
                flag = False
                break

        if flag:
            b.append(a[i])
            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    # bにチェックする数を追加していく
    b = []
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        flag = True
        for j in b:
            if j * 2 > a[i]:
                break
            if a[i] % j == 0:
                flag = False
                break

        if flag:
            b.append(a[i])
            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

if n == 1:
  print(1)
  exit()

a.sort()

b = []
ans = 0

for i in range(n):
  if a[i] == a[i-1]:
    continue
  j = 0
  flag = True
  while j < len(b) and b[j] * 2 <= a[i]:
    if a[i] % b[j] == 0:
      flag = False
      break
    else:
      j += 1
  if flag:
    b.append(a[i])
    if i == n-1 or a[i] != a[i+1]:
      ans += 1

print(ans)

Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

if n == 1:
  print(1)
  exit()

a.sort()

b = []
ans = 0

for i in range(n):
  if a[i] == a[i-1]:
    continue
  j = 0
  flag = True
  while j < len(b) and b[j] * 2 <= a[i]:
    if a[i] % b[j] == 0:
      flag = False
      break
    else:
      j += 1
  if flag:
    b.append(a[i])
    if i == n-1 or a[i] != a[i+1]:
      ans += 1

print(ans)

Fixed submission:
from sys import stdin

def main():

    n = int(stdin.readline().strip())
    a = list(map(int, stdin.readline().strip().split()))

    if n == 1:
        print(1)
        exit()

    a.sort()

    dp = [True] * (a[-1] + 1)
    ans = 0

    for i in range(n):

        if a[i] == a[i-1]:
            continue

        if dp[a[i]]:

            for j in range(2 * a[i], a[-1] + 1, a[i]):
                dp[j] = False

            if i == n-1 or a[i] != a[i+1]:
                ans += 1

    print(ans)

main()