#include <bits/stdc++.h>
using namespace std;
long long b[61];
unsigned long long expo(unsigned long long base, unsigned long long power,
                        unsigned long long mod) {
  unsigned long long res = 1;
  while (power > 0) {
    if (power & 1) res = (res * base) % mod;
    power = power >> 1;
    base = (base * base) % mod;
  }
  return res;
}
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(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))
        ans = (ans + ((1ull << j) * b[j]) % 1000000007) % 1000000007;
  cout << ans << '\n';
}
