#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

ll gcd(ll x, ll y) {
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  ll q = a / b;
  ll g = extgcd(b, a - q * b, x, y);
  ll z = x - q * y;
  x = y, y = z;
  return g;
}

ll lcm(ll x, ll y) {
  // TODO:
  return 0;
}

bool isPrime(ll x) {
  if (x == 1) {
    return false; // by definition of prime
  }

  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

ll facto(ll n){
    ll r = 1;
    for(int i = n; i > 1; i++) r*=i;
    return r;
}

ll nCr(ll n, ll r) {
  if (n < r) {
    return 0;
  }
  ll p = 1, k = 1;
  if (n - r < r)
    r = n - r;

  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      ll m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else {
    p = 1;
  }
  return p;
}


template <ll _M = 1000000007> class FactorialProvider {
public:
  FactorialProvider(){};
  ~FactorialProvider(){};

  ll operator()(ll x) {
    ll ret = 1;
    for (ll i = 1; i <= x; i++) {
      ret = (ret * i % _M) % _M;
    }
    return ret;
  }
};

template <ll _M = 1000000007> class PrecomputedFactorialProvider {
public:
  PrecomputedFactorialProvider() : _max(0) {
    _facto.push_back(1);
    _factoinv.push_back(1);
  };

  ~PrecomputedFactorialProvider(){};

  ll operator()(ll x) { return facto(x); }

  ll facto(ll x) {
    if (x > _max) {
      ll cur = _facto[_max];
      _facto.resize(x + 1);
      for (ll i = _max + 1; i <= x; i++) {
        cur = (cur * i) % _M;
        _facto[i] = cur;
      }

      _factoinv.resize(x + 1);
      ll a, b;
      extgcd(_facto[x], _M, a, b);
      _factoinv[x] = (a + _M) % _M;
      for (ll i = x; i > _max + 1; i--) {
        _factoinv[i - 1] = (_factoinv[i] * i) % _M;
      }

      _max = x;
    }
    return _facto[x];
  }

  ll inv(ll x) {
    if (x > _max) {
      facto(x);
    }
    return _factoinv[x];
  }

private:
  vector<ll> _facto;
  vector<ll> _factoinv;
  ll _max;
};

template <ll _M = 1000000007,
          class FProvider = PrecomputedFactorialProvider<_M>>
class Modulo {
public:
  Modulo() : _num(0) {}
  Modulo(ll num) : _num(num % _M){};
  ~Modulo(){};

  ll num() { return _num; };
  explicit operator ll() { return _num; };

  Modulo<_M> &add(const Modulo<_M> &rhs) {
    // TODO: check overflow
    _num = (_num + rhs._num) % _M;
    return *this;
  }

  Modulo<_M> &sub(const Modulo<_M> &rhs) {
    // TODO: check overflow
    _num = ((_num - rhs._num) % _M + _M) % _M;
    return *this;
  }

  Modulo<_M> &mul(const Modulo<_M> &rhs) {
    // TODO: check overflow
    _num = (_num * rhs._num) % _M;
    return *this;
  }

  Modulo<_M> &div(const Modulo<_M> &rhs) {
    // TODO: check overflow
    this->mul(rhs.inv());
    return *this;
  }

  static Modulo<_M> power(ll x, ll n) {
    if ( n == 0 ) return 1;
    ll cur = x;
    x = 1;
    while (n != 0) {
      if (n & 1) x = (x * cur) % _M;
      cur  = (cur * cur) % _M;
      n >>= 1;
    }

    return x;
  }

  static Modulo<_M> nCr(ll n, ll r) {
      if( n < r ){
          return 0;
      }

      return _fprovider.facto(n) * Modulo<_M>(_fprovider.inv(r)) * Modulo<_M>(_fprovider.inv(n - r));
  }

  Modulo<_M> inv() const {
    ll x, y;
    extgcd(_num, _M, x, y);
    return (x + _M) % _M;
  }

  Modulo<_M> facto() const { return _fprovider(_num); }

  Modulo<_M> factoinv() const { return _fprovider.inv(_num); }

  // https://stackoverflow.com/questions/9787593/implicit-type-conversion-with-template/9789036#9789036
  friend Modulo<_M> operator+(const Modulo<_M> &lhs, const Modulo<_M> &rhs) {
    return Modulo<_M>(lhs).add(rhs);
  }
  friend Modulo<_M> operator-(const Modulo<_M> &lhs, const Modulo<_M> &rhs) {
    return Modulo<_M>(lhs).sub(rhs);
  }
  friend Modulo<_M> operator*(const Modulo<_M> &lhs, const Modulo<_M> &rhs) {
    return Modulo<_M>(lhs).mul(rhs);
  }
  friend Modulo<_M> operator/(const Modulo<_M> &lhs, const Modulo<_M> &rhs) {
    return Modulo<_M>(lhs).div(rhs);
  }

  friend bool operator==(Modulo<_M> &lhs, const Modulo<_M> &rhs) {
    return lhs._num == rhs._num;
  }

private:
  ll _num;
  static FProvider _fprovider;
};

template <ll _M, class FProvider> FProvider Modulo<_M, FProvider>::_fprovider;


int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;

    cin >> N;
    vector<ll> array(N, 0);

    REP(i, N){ cin >> array[i]; }

    Modulo<> ans(0);
    for(int i = 0; i < 60; i++ ){
        ll mask = 1LL << i;
        ll count1 = 0;
        ll count0 = 0;
        REP(j, N){
            if( mask & array[j] ){
                count1++;
            }else{
                count0++;
            }
        }
        ans = ans + Modulo<>::power(2,i) * (count1*count0);
    }

    cout << ll(ans) << endl;

    return 0;
}


Measured memory_bytes: 2560