# [51Nod](1596)搬货物 ---- 思维

1，1，2作为一组。

3，3作为一组。

## Input示例

5
1 1 2 3 3

2^2+2^2 = 2^3 = 2*(2^2)

AC代码：

#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e6+5;
int a[maxn];
int n;
int ans = 0;
const int MAXBUF = 10000;
char buf[MAXBUF], *ps = buf, *pe = buf+1;
inline void rnext()
{
if(++ps == pe)
}

template <class T>
inline bool in(T &ans)
{
ans = 0;
T f = 1;
if(ps == pe) return false;//EOF
do{
rnext();
if('-' == *ps) f = -1;
}while(!isdigit(*ps) && ps != pe);
if(ps == pe) return false;//EOF
do
{
ans = (ans<<1)+(ans<<3)+*ps-48;
rnext();
}while(isdigit(*ps) && ps != pe);
ans *= f;
return true;
}
const int  MAXOUT=10000;
char bufout[MAXOUT], outtmp[50],*pout = bufout, *pend = bufout+MAXOUT;
inline void write()
{
fwrite(bufout,sizeof(char),pout-bufout,stdout);
pout = bufout;
}
inline void out_char(char c){ *(pout++) = c;if(pout == pend) write();}
inline void out_str(char *s)
{
while(*s)
{
*(pout++) = *(s++);
if(pout == pend) write();
}
}
template <class T>
inline void out_int(T x) {
if(!x)
{
out_char('0');
return;
}
if(x < 0) x = -x,out_char('-');
int len = 0;
while(x)
{
outtmp[len++] = x%10+48;
x /= 10;
}
outtmp[len] = 0;
for(int i = 0, j = len-1; i < j; i++,j--) swap(outtmp[i],outtmp[j]);
out_str(outtmp);
}
//
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
#endif // LOCAL
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL),cout.tie(NULL);
memset(a,0,sizeof(a));
int e;
in(n);
for(int i=1;i<=n;i++)
{
in(e);
a[e]++;
}
for(int i=0;i<=maxn-5;i++)
{
if(a[i]>1)
{
a[i+1] += a[i]/2;
a[i]%=2;
}
if(a[i] == 1) ans++;
}
out_int(ans);
write();
return 0;
}