Edit the following Python Program to count the occurrences of a specific number.
arr = [1, 2, 2, 3, 4]
num = 2

count = 0

for i in arr:
arr = [1, 2, 2, 3, 4]
num = 2

count = 0

for i in arr:
    if i == num:
        count += 1

print(count) #outputs 2