#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
typedef vector<int> vi;
inline int in() { int x; cin >> x; return x; }
int MOD = 1000000007;
struct mint {
  int x;
  mint (int x = 0) : x(x % MOD){}
  mint& operator+=(const mint a) { (x+=a.x) %= MOD; return *this; }
  mint& operator*=(const mint a) { (x*=a.x) %= MOD; return *this; }
};

void solve() {
  int n = in()
  mint m = 0;
  vi v(n); for (auto &i : v) i = in();
  FOR(i,0,60) {
    int odd = 0, even = 0;
    for (auto j : v) (((j>>i)&1) ? odd : even)++;
    mint k = (int)1 << i;
    k *= odd * even;
    m += k;
  }
  cout << m << endl;
}

#undef int
int main() {
  solve();
  return 0;
}
