#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long ttt = 1;
long long n, a[2256], ans, cnt;
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < 61; i++) {
    cnt = 0;
    for (long long j = 0; j < n; j++)
      if (a[j] & (1LL << i)) cnt++;
    ans += (((cnt * (n - cnt)) % 1000000007) * ((1LL << i) % 1000000007)) %
           1000000007;
    ans %= 1000000007;
  }
  cout << ans;
}
int main() {
  for (int i = 0; i < ttt; i++) solve();
}
