#include <bits/stdc++.h>

// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */
using mint = modint1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) { cin >> a[i]; }
  vector<ll> cnt1(60, 0), cnt0(60, 0);
  REP(i, n) {
    REP(j, 60) {
      if (a[i] & (1ll << j))
        cnt1[j]++;
      else
        cnt0[j]++;
    }
  }
  ll ans = 0;
  REP(i, 60) {
    ans += cnt1[i] % MOD * cnt0[i] % MOD * (ll)powl(2, i) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}
