#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a > b ? b : a; }
int max(int a, int b) { return a > b ? a : b; }
long int min(long int a, long int b) { return a > b ? b : a; }
long int max(long int a, long int b) { return a > b ? a : b; }
const int N = 100050;
int a[N];
int main() {
  int n, i;
  scanf("%i", &n);
  if (n == 1) return printf("1 "), 0;
  if (n == 2) return printf("1 2 "), 0;
  int k = 1, sol = n + 1;
  for (i = 2; i <= n; i++) {
    int ans = i + (n + i - 1) / i;
    if (ans < sol) sol = ans, k = i;
  }
  for (i = 1; i <= n; i++) a[i] = n - i + 1;
  for (i = 1; i <= n; i += k) {
    int l = i, r = i + k;
    if (r > n + 1) r = n + 1;
    reverse(a + l, a + r);
  }
  for (i = 1; i <= n; i++) printf("%i ", a[i]);
  return 0;
}
