Help with Lattice Estimator

How do I determine the values of n and q to be fed to lattice estimator from openFHE library?

For example, suppose I am running the example code advanced-ckks-bootstrapping.cpp and have set the value of ring dimension as 2^16 (parameters.SetRingDim(1<<16), is n=65536 in this case? Also, how can I determine q in this example? I see in this previous discussion how log q bits are generated. So, would the value of q to be fed to the estimator be 2^(number of log q elements printed), that is 2^40?
I am finding it very confusing to understand the difference in p,q and Q and set the values in lattice estimator. I see in this paper, the value of logq in the tables extend to 829 (table 2). So is q=2^829 and also is 829 the size of the moduli chain? How do I figure out the size of the moduli chain in this case?

Hi @sp18,

I suggest using this example as the reference: openfhe-development/src/pke/examples/SHE_table.cpp at security-guidelines · openfheorg/openfhe-development · GitHub \log PQ is the ciphertext modulus size that needs to be entered in the lattice estimator (you can omit GetMSB() to show the actual modulus or you can use 2^{\log {PQ}} for the estimate). This modulus is used to encrypt the evaluation keys.