n=int(input())
a=list(map(int,input().split()))
ori_num=len(a)

a.append(-1)

result=0
for i in range(len(a)-1):
  for j in range(i+1,ori_num,2):
    if -1==j+1:
      result+=a[i]^a[j]
    else:
      result+=a[j]+a[j+1]
    
print(result%(10**9+7))
    