#include <bits/stdc++.h>
using namespace std;
long long b[61];
signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  long long ans = 0;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    for (__typeof(60) j = (0) - ((0) > (60)); j != (60) - ((0) > (60));
         j += 1 - 2 * ((0) > (60)))
      if (a[i] & (1ull << j)) b[j]++;
  for (__typeof(60) i = (0) - ((0) > (60)); i != (60) - ((0) > (60));
       i += 1 - 2 * ((0) > (60)))
    ans = (ans +
           ((((1ull << i) * (n - b[i])) % 1000000007) * b[i]) % 1000000007) %
          1000000007;
  cout << ans << '\n';
}
