#include <bits/stdc++.h>
using namespace ::std;
using vpll = vector<pair<long long, long long> >;
using pll = pair<long long, long long>;
using vll = vector<long long>;
using ll = long long;
inline void fastInputOutput() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
inline void ReadWriteFromFile() {
  freopen("../in.txt", "r", stdin);
  freopen("../out.txt", "w", stdout);
}
long long a[(ll)(2e6 + 7)], bits[(ll)(5e3 + 7)][2];
int32_t main(int32_t argc, char *argv[]) {
  fastInputOutput();
  long long n, ans = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    vector<long long> v;
    long long a;
    cin >> a;
    for (long long i = 0; i < 64; i++) {
      v.push_back(a & 1);
      a >>= 1;
    }
    long long k = v.size();
    for (long long i = 0; i < k; i++) bits[i][v[i]]++;
    v.clear();
  }
  for (long long i = 0; i < 64; i++)
    ans += bits[i][0] * bits[i][1] * (1ll << i) % (ll)(1e9 + 7);
  cout << ans;
}
