Q:

How to count number of records if number of records is more than 50,000 limit?

Following query won't work if number of records is more than 50,000.
Integer c = [SELECT COUNT() FROM MyObj__C];

Is there a workaround to do calculation anyway?

A:

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_readonly_context.htm
Set the context to read Only .Read only on page will allow you to query for million records atleast 
<apex:page controller="SummaryStatsController" readOnly="true">
   <p>Here is a statistic: {!veryLargeSummaryStat}</p>
</apex:page>

Controller code
public class SummaryStatsController {
public Integer getVeryLargeSummaryStat() {
    Integer closedOpportunityStats = 
        [SELECT COUNT() FROM Opportunity WHERE Opportunity.IsClosed = true];
    return closedOpportunityStats;
}
}

