#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C &a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C &a4, C b4) {
  a4 = max(a4, b4);
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
long long getLis(vector<long long> perm) {
  long long n = ((long long)(perm).size());
  vector<long long> lis(n + 1, INT_MAX);
  for (long long a : perm) {
    *lower_bound((lis).begin(), (lis).end(), a) = a;
  }
  for (long long i = (0); i <= ((long long)(n + 1) - 1); i++) {
    if (lis[i] == INT_MAX) {
      return i;
    }
  }
  assert(false);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  if (0) cout << fixed << setprecision(6);
  long long n;
  cin >> n;
  long long a = 1;
  while (a * a < n) {
    a++;
  }
  long long last = a;
  long long fl = 1;
  vector<long long> perm;
  for (long long i = (0); i <= ((long long)(n)-1); i++) {
    cout << last << " ";
    perm.push_back(last);
    if (last == fl) {
      fl += a;
      last = min(fl + a - 1, n);
    } else {
      last--;
    }
  }
  long long x = getLis(perm);
  for (long long &a : perm) {
    a = -a;
  }
  x += getLis(perm);
  cout << endl;
  (x);
}
