def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    for i in range(0,n-1):
        for j in range(i+1,n):
            temp=(a[i] ^ a[j])
            ans+=temp%MOD
    print(ans%MOD)
if __name__=='__main__':
    main()
