calculate squares