def main():
    num = input()
    num_list = list(map(int, input().split(" ")))
    result = sum([sum([num_list[i]^num_list[j] for j in range(i)]) for i in range(int(num))])
    print(result%(10**9+7))    

if __name__ == "__main__":
    main()