#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n == 1) {
    cout << "1";
    return 0;
  }
  if (n == 2) {
    cout << "1 2";
    return 0;
  }
  if (n == 3) {
    cout << "2 3 1";
    return 0;
  }
  if (n == 4) {
    cout << "3 4 1 2";
    return 0;
  }
  if (n == 5) {
    cout << "3 4 5 1 2";
    return 0;
  }
  if (n == 6) {
    cout << "4 5 6 1 2 3";
    return 0;
  }
  int kek = sqrt(n);
  for (int i = 1; i <= kek + 10; i++) {
    for (int j = i * kek; j > (i - 1) * kek; j--) {
      if (j > n) continue;
      cout << j << " ";
    }
  }
}
