#include <bits/stdc++.h>
using namespace std;
int n, a[100010];
int read(int x = 0) {
  char c, f = 1;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  return f * x;
}
bool judge(int x) {
  int i;
  for (i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
int find(int x) {
  int i;
  for (i = 2; i <= x; i++)
    if (x % i == 0) return i;
}
void rev(int l, int r) {
  int i, j;
  for (i = l, j = r; i <= j; i++, j--) swap(a[i], a[j]);
}
int main() {
  int i, m;
  n = read();
  m = sqrt(n);
  for (i = 1; i <= n; i++) a[i] = i;
  for (i = 1; i <= n; i += m) rev(i, min(i + m - 1, n));
  for (i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
