Recaman sequence

Hi all,
I saw the Recaman Sequence the other day so i decided to program it. Here’s the code i wrote, any ideas?:

n = int(input(">"))
list = ['0']
i = 1
a = 0
while i < n:
   
    if str(a - i) not in list:
        if a-i>=0:
            a -= i
            list.append(str(a))
        else:
             a += i
             list.append(str(a))
       
        
    else:
        a += i
        list.append(str(a))
    i += 1
     
print(list)```