#!/usr/bin/env python
# coding: utf-8

# In[16]:


N = int(input())
A = [int(x) for x in input().split()]
MOD = 10 ** 9 + 7


# In[17]:


count = [0] * 60
for i in range(N):
    s = format(A[i], '060b')
    for d in range(60):
        count[d] += int(s[d])


# In[18]:


# print(count)


# In[19]:


ans = 0
for d in range(60):
    ans = (ans + 2 ** (59 - d) * count[d] * (N - count[d])) % MOD


# In[20]:


print(ans)


# In[ ]:




