#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MOD = 1e9 + 7;
const int INT_INF = 1e9, INT_MOD = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  long long a[n + 1], maxn = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    maxn = max(maxn, a[i]);
  }
  long long keta = 0, ans = 0, tmp2 = 1;
  for (long long i = maxn; maxn > 0; maxn /= 2) keta++;
  long long xo[keta + 1][2];
  for (int i = 0; i < keta + 1; i++)
    for (int j = 0; j < 2; j++) xo[i][j] = 0;
  for (int i = 0; i < keta; i++) {
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1)
        xo[i][1]++;
      else
        xo[i][0]++;
    }
    ans += (tmp2 * xo[i][0] * xo[i][1]) % INT_MOD;
    ans %= INT_MOD;
    tmp2 *= 2;
  }
  cout << ans << endl;
  return 0;
}
