#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
struct mint {
  long long x;
  mint(long long x=0):x(x%MOD){}
  mint& operator+=(const mint a) { if ((x+=a.x)>=MOD) x-=MOD; return *this; }
  mint& operator-=(const mint a) { if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this; }
  mint& operator*=(const mint a) { (x*=a.x)%=MOD; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res+=a; }
  mint operator-(const mint a) const { mint res(*this); return res-=a; }
  mint operator*(const mint a) const { mint res(*this); return res*=a; }
  mint operator++() { return *this=mint(x+1); }
  mint operator--() { return *this=mint(x-1); }
};
#define int mint

#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; }
inline int in() { int x; scanf("%d",&x); return x;}
void solve() {
  int n = in(), 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)++;
    int k = (int)1 << i;
    k %= MOD;
    k *= (odd*even) % MOD;
    m += k;
    m %= MOD;
  }
  cout << m << endl;
}

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