#include <bits/stdc++.h>
using namespace std;
int n;
long long res = 0;
int main() {
  cin >> n;
  long long tmp = 0;
  int indez = 1;
  for (int i = 1; i <= n - 1; i++) {
    tmp += indez;
    indez += 2;
  }
  res = tmp * 2;
  res += (n * 2 - 1);
  cout << res;
  return 0;
}
