def main():
    # input
    import sys
    input = sys.stdin.readline
    MAX = 10**9+7

    n = int(input())
    a = tuple(map(int, input().split()))
    ans = 0
    for first, i in enumerate(a[:n-1]):
        for j in a[first:n]:
            ans += i^j
    print(ans%MAX)



    # calc


if __name__ == '__main__':
    main()
