#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 10000 + 10;
bool mark[MAXN];
bool mark2[MAXN];
int ans[MAXN];
long long mod = 998244353;
int n, m;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, t = 1;
  cin >> n;
  for (int i = 2; i * i <= n; i++) {
    t = i;
  }
  for (int i = 1; i <= n; i++) {
    ans[n - i] = i;
  }
  int y = 0;
  for (int i = 0; i + t <= n; i += t) {
    y = i + t;
    reverse(ans + i, ans + i + t);
  }
  if (y != n) reverse(ans + y, ans + n);
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
